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
.
Add a comment
|
1 Answer
Use find
command:
find /path/to/directory -type f -empty > zerobyte.txt
-type f
look only for files-empty
finds empty files
-
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 Jan 31, 2020 at 15:01