How about using opendir() and readdir()?
my $dir = '/tmp/foo'; if ( my @contents = dir_contents( $dir ) { do_something_about_it( $dir, @contents ); } else { it_is_empty( $dir ) } sub dir_contents { my $dir = shift; opendir DIR, $dir or die "Couldn't open $dir: $!"; return grep !/^\.\.?$/, readdir DIR; }
-Colin.
WHITEPAGES.COM | INC
In reply to Re: checking to see if a directory is empty
by cmeyer
in thread checking to see if a directory is empty
by drum1981
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |