in reply to How to tell if a Directory is Empty
You can grep the list of files for anything other than '.' and '..', and since any results from grep will equal true:
opendir my $dir, $dirname or die $!; if( grep ! /^\.\.?$/, readdir $dir ){ print 'stuff in here'; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to tell if a Directory is Empty
by jwkrahn (Abbot) on Oct 29, 2011 at 02:49 UTC |