Find all files in a directory /path/to/directory and its sub-directories recursively:
find /path/to/directory/ -size 0 -type f
or
find /path/to/directory/ -size 0 -type f -print
Extend:
- Filter and display all files with file size 0 byte and have extension png:
find /path/to/directory/ -size 0 -type f -name '*.png'
- Delete all files with file size 0 byte
find /path/to/directory/ -size 0 -type f -delete
Comments