Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've just recovered tons of files (distributed in a complex directory structure, having very long names, using Unicode symbols, spaces etc in names) from a damaged hard drive. Now I'd like to verify all files which contain verification information (like zip archives (including LibreOffice and other XML-in-ZIP kind documents), 7z and rar archives, self-extracting exe arcives etc.)

How can I achieve this?

share|improve this question

To locate files by name:

find /mount/point -type f \( \
    \( -name '*.zip' -o -name '*.o[dt][bcfghipst]' \) -exec unzip -t {} \; \
    -o -name '*.7z' -exec 7z t {} \; \
    …   \)

find /mount/point -type f \( -name '*.7z' -o -name '*.o[dt][bcfghipst]' \) -exec unzip -t {} \;

To locate files by type:

find /mount/point -type f -exec sh -c '
  case "$(file --mime-type -b - <"$0")" in
    application/zip) unzip -t "$0";;
    application/x-7z-compressed) 7z t "$0";;
    application/rar) unrar t "$0";;
' {} \;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.