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 );
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.