This question already has an answer here:
I'm trying to write a bash script that will go into a directory loop through the .gz files and delete them if they are empty (ie the uncompressed file contained within in empty.
I've got a couple of questions:
- Is there a standard file size of a compressed (gz) empty file I can check for?
- Or is there a better way to check if a gz contains an empty file without decompressing it with a bash script?
I was trying to use the following code to acheive this but it relies on the filesize being 0 i think.
for f in dir/* do if [[ -s $f ]] then do_file_creation fi done