[Techtalk] zero byte file deletes

Mary mary-linuxchix at puzzling.org
Sun Nov 6 10:16:33 EST 2005


On Sat, Nov 05, 2005, Almut Behrens wrote:
>   find . -size 0 -exec rm -f {} \;
>   find . -maxdepth 1 -size 0 -exec rm -f {} \;

It seems like Almut's command worked out fine for Paul, but just in
case, it's often worth rnning find without the -exec to see what files
it thinks matches. Eg, "find . -size 0" will give you a *list* of all
files with zero bytes. If that list looks fine you can run "find . -size
0 -exec rm -f {} \;"  otherwise, no harm done. (This is much like the
idea that before you run "rm *" you should run "ls *" to see what * is
going to match.)

-Mary


More information about the Techtalk mailing list