Empty directory: Difference between revisions
Added Delphi example
MaiconSoft (talk | contribs) (Added Delphi example) |
|||
Line 394:
}</lang>
<pre>somedir is empty: false</pre>
=={{header|Delphi}}==
{{libheader| System.SysUtils}}
{{libheader| System.IOUtils}}
{{Trans|C#}}
<lang Delphi>
program Empty_directory;
{$APPTYPE CONSOLE}
uses
System.SysUtils,
System.IOUtils;
function IsDirectoryEmpty(dir: string): Boolean;
var
count: Integer;
begin
count := Length(TDirectory.GetFiles(dir)) + Length(TDirectory.GetDirectories(dir));
Result := count = 0;
end;
var
i: Integer;
const
CHECK: array[Boolean] of string = (' is not', ' is');
begin
if ParamCount > 0 then
for i := 1 to ParamCount do
Writeln(ParamStr(i), CHECK[IsDirectoryEmpty(ParamStr(i))], ' empty');
Readln;
end.</lang>
{{out}}
The same of c#.
=={{header|Elixir}}==
<lang elixir>path = hd(System.argv)
|