Rob Dixon wrote: > Nishi Bhonsle wrote: >> >> If I am still using the below logic, how can i modify the below prog >> to ignore empty directories and list only directories containing >> directories >> and files in buildlist.txt ? >> >> opendir DIR, $path or die "Can't open $path: $!"; >> >> #my @new = grep /[^.]/, readdir DIR; >> my @new = grep { $_ ne "." and $_ ne ".." } readdir DIR; >> closedir DIR; >> >> open FILE,">>C:\buidlist.txt"; >> print FILE "$_\n" foreach @new; >> close FILE; > > To check whether a directory's empty or not you need to read /that/ > directory in turn.
Not necessarily, you should be able to tell by stat()ing the size of the directory (this works on Linux, I don't know about DOS/Windows.) John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>