I am looking for a simple .sh script which can scan the current folder and sub folders recursively for 0 byte files. I know this can be done in only a few lines, but I'm quite noobian on the command line of Linux. It would be great if the output could be listed to a text file, like > 0byte.txt.


Use find command:

find /path/to/directory -type f -empty > zerobyte.txt
  • -type f look only for files
  • -empty finds empty files
| improve this answer | |
  • thanks ! it works ! i changed the path so that i could scan the current folder and all of its subfolders - find ./ -type f -empty > 0byte.txt – Bas Lamerichs Jan 31 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.