Created
October 27, 2011 10:23
-
-
Save jiphex/1319227 to your computer and use it in GitHub Desktop.
Count files in a (LARGE) directory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
if (!defined($ARGV[0]) or ! -d $ARGV[0]) { | |
print "Supply a valid path\n"; | |
} | |
opendir(THEDIR,$ARGV[0]); | |
my $counter = 0; | |
while (my $file = readdir(THEDIR)) { | |
$counter++; | |
} | |
closedir(THEDIR); | |
print "$counter $ARGV[0]\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment