pixelb / fslint

Linux file system lint checker/cleaner
314 stars 74 forks source link

Add an option to find zero-byte (0x00) filled (corrupted) files #164

Open Baltix opened 4 years ago

Baltix commented 4 years ago

When cleaning client computers I find a lot of "corrupted" files with correct file size and filename, however instead of containing real data, they are just filled with 0000 0000 0000 0000 0000 0000 0000 0000 (zero bytes, if looking with hexdump). Since these files only take disk space it would be nice to automate finding and deleting them all. So, please add an option to find files that are filled with zeros.

Now I'm using this command to find zero-byte filled files: cat myfile | tr -d '\0' | read -n 1 || echo "All zeroes." See https://stackoverflow.com/questions/20224822/how-to-check-if-a-file-contains-only-zeros-in-a-linux-shell https://stackoverflow.com/questions/51345446/using-grep-to-find-and-delete-files-that-are-filled-with-zeros