Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hello I have a train wreck of some code, basically what this patch work of code is suppose to do is search through a directory, each file, each folder, looking for those with sizes == 0,and output the file or folder path name, surprise its not working, im thinking because its just "slurping" the entire directory at once and not looping through each individual element of the directory, if there are any merciful monks who could give some advice I would appreciate it.
$source = $x; $File::Find::dont_use_nlink = 1; File::Find::find( sub { if (-f $File::Find::name) { find(sub { $size1 += -s if -f $_ }, $File::Find::name); if ($size1 == 0) { print $File::Find::name;} } elsif (-d $File::Find::name) { find(sub { $size2 += -s if -d $_ }, $File::Find::name) +; if ($size2 == 0) { print $File::Find::name;} }; }, $source );
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: function help
by moritz (Cardinal) on Jun 03, 2008 at 15:57 UTC | |
Re: function help
by starbolin (Hermit) on Jun 03, 2008 at 16:34 UTC | |
Re: function help
by pc88mxer (Vicar) on Jun 03, 2008 at 16:51 UTC |
Back to
Seekers of Perl Wisdom