Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
24
Task/Empty-directory/Ada/empty-directory.adb
Normal file
24
Task/Empty-directory/Ada/empty-directory.adb
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
with Ada.Text_IO; use Ada.Text_IO;
|
||||
with Ada.Directories;
|
||||
procedure EmptyDir is
|
||||
function Empty (path : String) return String is
|
||||
use Ada.Directories;
|
||||
result : String := "Is empty.";
|
||||
procedure check (ent : Directory_Entry_Type) is begin
|
||||
if Simple_Name (ent) /= "." and Simple_Name (ent) /= ".." then
|
||||
Empty.result := "Not empty";
|
||||
end if;
|
||||
end check;
|
||||
begin
|
||||
if not Exists (path) then return "Does not exist.";
|
||||
elsif Kind (path) /= Directory then return "Not a Directory.";
|
||||
end if;
|
||||
Search (path, "", Process => check'Access);
|
||||
return result;
|
||||
end Empty;
|
||||
begin
|
||||
Put_Line (Empty ("."));
|
||||
Put_Line (Empty ("./empty"));
|
||||
Put_Line (Empty ("./emptydir.adb"));
|
||||
Put_Line (Empty ("./foobar"));
|
||||
end EmptyDir;
|
||||
10
Task/Empty-directory/Gleam/empty-directory.gleam
Normal file
10
Task/Empty-directory/Gleam/empty-directory.gleam
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import gleam/io
|
||||
import simplifile
|
||||
|
||||
pub fn main() {
|
||||
case simplifile.read_directory("/somepath") {
|
||||
Ok([]) -> io.println("Directory is empty")
|
||||
Ok([_, ..]) -> io.println("Directory isn't empty")
|
||||
Error(_) -> io.println("Some error")
|
||||
}
|
||||
}
|
||||
6
Task/Empty-directory/PowerShell/empty-directory.ps1
Normal file
6
Task/Empty-directory/PowerShell/empty-directory.ps1
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
$path = "C:\Users"
|
||||
if((Dir $path).Count -eq 0) {
|
||||
"$path is empty"
|
||||
} else {
|
||||
"$path is not empty"
|
||||
}
|
||||
1
Task/Empty-directory/Rebol/empty-directory.rebol
Normal file
1
Task/Empty-directory/Rebol/empty-directory.rebol
Normal file
|
|
@ -0,0 +1 @@
|
|||
print either empty? read %testdir/ ["empty"]["not empty"]
|
||||
1
Task/Empty-directory/Red/empty-directory.red
Normal file
1
Task/Empty-directory/Red/empty-directory.red
Normal file
|
|
@ -0,0 +1 @@
|
|||
print either empty? read %testdir/ [print "empty"][print "not empty"]
|
||||
12
Task/Empty-directory/VBScript/empty-directory.vbs
Normal file
12
Task/Empty-directory/VBScript/empty-directory.vbs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
Function IsDirEmpty(path)
|
||||
IsDirEmpty = False
|
||||
Set objFSO = CreateObject("Scripting.FileSystemObject")
|
||||
Set objFolder = objFSO.GetFolder(path)
|
||||
If objFolder.Files.Count = 0 And objFolder.SubFolders.Count = 0 Then
|
||||
IsDirEmpty = True
|
||||
End If
|
||||
End Function
|
||||
|
||||
'Test
|
||||
WScript.StdOut.WriteLine IsDirEmpty("C:\Temp")
|
||||
WScript.StdOut.WriteLine IsDirEmpty("C:\Temp\test")
|
||||
Loading…
Add table
Add a link
Reference in a new issue