Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -1,3 +1,4 @@
|
|||
Starting with a path to some directory, determine whether the directory is empty.
|
||||
|
||||
An empty directory contains no files nor subdirectories. With [[Unix]] or [[Windows]] systems, every directory contains an entry for “<code>.</code>” and almost every directory contains “<code>..</code>” (except for a root directory); an empty directory contains no other entries.
|
||||
An empty directory contains no files nor subdirectories.
|
||||
With [[Unix]] or [[Windows]] systems, every directory contains an entry for “<code>.</code>” and almost every directory contains “<code>..</code>” (except for a root directory); an empty directory contains no other entries.
|
||||
|
|
|
|||
19
Task/Empty-directory/C-sharp/empty-directory.cs
Normal file
19
Task/Empty-directory/C-sharp/empty-directory.cs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
|
||||
class Program
|
||||
{
|
||||
static void Main( string[] args )
|
||||
{
|
||||
foreach ( string dir in args )
|
||||
{
|
||||
Console.WriteLine( "'{0}' {1} empty", dir, IsDirectoryEmpty( dir ) ? "is" : "is not" );
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsDirectoryEmpty( string dir )
|
||||
{
|
||||
return ( Directory.GetFiles( dir ).Length == 0 &&
|
||||
Directory.GetDirectories( dir ).Length == 0 );
|
||||
}
|
||||
}
|
||||
1
Task/Empty-directory/Ruby/empty-directory.rb
Normal file
1
Task/Empty-directory/Ruby/empty-directory.rb
Normal file
|
|
@ -0,0 +1 @@
|
|||
Dir.entries("testdir").empty?
|
||||
Loading…
Add table
Add a link
Reference in a new issue