Jair Santos wrote: > Hi all, > > does anybody knows how to check if a diretory is empty?
Does this suit what you want? It's got very inelegant error
handling but should suffice for most purposes.
use strict;
print nfiles('/usr/bin');
sub nfiles {
opendir my $dh, $_[0] or die $!;
my @dir = readdir $dh;
return scalar @dir;
}
HTH,
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
