in reply to How to delete empty files
find ./path -type f -empty -exec rm '{}' \;
Or use File::Find::Rule
#!/usr/bin/perl use strict; use warnings; use Smart::Comments '###'; use File::Find::Rule; my $f = new File::Find::Rule->file()->empty(); my @files = $f->in($ENV{HOME}); # where to look ### @files for my $abs_file( @files ) { unlink $abs_file or die("cant unlink $abs_file, $!"); } # or use map # map { unlink $_ } @files;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to delete empty files
by padawan_linuxero (Scribe) on Jan 11, 2008 at 00:37 UTC | |
by leocharre (Priest) on Jan 11, 2008 at 11:03 UTC |