Bash – How to find corrupted archive files

bashzip

I have a lot of zip files. Some are not downloaded correctly and are corrupted. I want to remove them.

Is there a way to find the corrupted archives in bash?

Best Answer

With GNU (for -readable and -iname) find:

find . -iname '*.zip' -type f -readable ! -exec unzip -t {} \; -exec rm -i {} \;
Related Question