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;
In reply to Re: How to delete empty files
by leocharre
in thread How to delete empty files
by padawan_linuxero
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |