Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
12
Task/Empty-directory/D/empty-directory.d
Normal file
12
Task/Empty-directory/D/empty-directory.d
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import std.stdio, std.file;
|
||||
|
||||
void main() {
|
||||
auto dir = "somedir";
|
||||
writeln(dir ~ " is empty: ", dirEmpty(dir));
|
||||
}
|
||||
|
||||
bool dirEmpty(string dirname) {
|
||||
if (!exists(dirname) || !isDir(dirname))
|
||||
throw new Exception("dir not found: " ~ dirname);
|
||||
return dirEntries(dirname, SpanMode.shallow).empty;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue