How to delete many 0 byte files in linux? How to delete many 0 byte files in linux? linux linux

How to delete many 0 byte files in linux?


Use find combined with xargs.

find . -name 'file*' -size 0 -print0 | xargs -0 rm

You avoid to start rm for every file.


With GNU's find (see comments), there is no need to use xargs :

find -name 'file*' -size 0 -delete


If you want to find and remove all 0-byte files in a folder:

find /path/to/folder -size 0 -delete