Linux: Remove all empty files from a directory

Nov 13, 2009

One-liner to remove all empty files from a directory:

ls -s | grep -e '^ 0' | sed 's/^...//' | xargs -n1 rm -v

Or these two, suggested by Jameson Williams on the Portland Linux/Unix Group (http://www.pdxlinux.org/):

  1. find . -empty -maxdepth 1 -delete

  2. find * -prune -empty -exec rm {}\;

Follow my posts