in reply to UNIX command - remove 0 byte file
And the perl way, with hidden files filtered out this time:find /whatever/path/ -size 0 -exec rm {} \;
Purge( '/whatever/path' ); sub Purge { my $dir = shift; open my $dh or die "$!, for $dir"; for my $file ( grep !/^\./, readdir $dh ) { my $path = "$dir/$file"; if ( -d $path ) { Purge( $path ); } else { ( -z $path ) and unlink $path; } } close $dh or die "$!, for $dir"; }
-M
Free your mind
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: UNIX command - remove 0 byte file
by thor (Priest) on Sep 23, 2005 at 11:28 UTC | |
by Moron (Curate) on Sep 23, 2005 at 12:33 UTC | |
by mhacker (Sexton) on Sep 23, 2005 at 12:55 UTC | |
by YuckFoo (Abbot) on Sep 23, 2005 at 17:28 UTC | |
by Anonymous Monk on Sep 23, 2005 at 12:48 UTC | |
by thor (Priest) on Sep 23, 2005 at 13:28 UTC | |
by Anonymous Monk on Sep 23, 2005 at 13:46 UTC | |
| |
by Moron (Curate) on Sep 23, 2005 at 13:59 UTC | |
by Anonymous Monk on Sep 23, 2005 at 14:15 UTC | |
| |
by Moron (Curate) on Sep 23, 2005 at 13:06 UTC |