How can I test all zip files in a folder to verify if they are corrupted or not?
Solution 1:
Find every zip-file in every subfolder
This will find in all subfolders of the current folder (.
) the files (-type f
) with the extension zip
(or ZIP
or Zip
or zIp
and so on, case is ignored, -iname
) and test their integrity (option -t
) being quiet (option -q
, together -tq
). Being quite means: Not list the content of the zip-file, but only report test result.
find . -type f -iname '*.zip' -exec unzip -tq {} \;
Just current folder (no subfolders)
If you just want to check the files in the current directory, and not in any subfolders, use
unzip -tq '*.[Zz][Ii][Pp]'
in the directory with the zip files. This also checks for file extensions ZIP
or Zip
or zIp
and so on, case is ignored.
Solution 2:
On Windows I use 7zip: it provides a graphical user interface, is free and supports a wide range of archive file formats including zip.
Navigate to the given folder you want to analyze on Windows Explorer. Search for *.zip
, select all files, right-click, select "Test Archive"
Then wait (note that it takes around 10 minutes for explorer.exe to go through 100,000 .zip before 7z start testing):
Solution 3:
erik's answer didn't work for me on a Mac but this works for zips in current folder and all subfolders:
find . -name '*.zip' -exec unzip -tq {} \;
Outputs this for each file:
No errors detected in compressed data of ./2013-10-16.zip.