Delete empty files using find


The following command will delete all empty files in the current directory and in all of its subdirectories:

find . -size 0 -delete

There is also a -empty flag, but it's not POSIX

find . -empty -delete

Add -maxdepth 1 to limit the search only to the current directory (no subdirectories)

The . (dot) is optional only for Linux. On macOS it is required to specify it.