I need analyze dir structure and find all files that larger than 515 kbytes and recursion doesn't work i have no clue why? Please help me without fancy module and package style. Thx a lot
#!/usr/bin/perl # #Author: Yury Sibirski #Name: users_home_dir #Date: 16 December 2014 #Purpose: This program analyze the directory structure of a Linux disk + and identify any files larger than 500 kbytes # $path = shift || '.'; read_dir($path); sub read_dir { $dir = shift; opendir (DH, $dir) or die "Couldn't open current directory: $! +"; while ($file = readdir(DH)) {#print "$file\n"; if ($file eq "." or $file eq "..") { next; } elsif (-z $file) { next; } elsif (-r $file and -f $file) { $size = -s $file; print $file," ",$size, "\n" if $size > 512000; } #recursion doesn't work i don't know why? # elsif (-d $file) # { # read_dir($file); # } } closedir DH; }
In reply to Hi Monks could you pls help Perl dummy user by sibyurik
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |