破損したハードドライブ(Unicodeシンボル、スペースなどを使用して長い名前の複雑なディレクトリ構造に分散しています)から大量のファイルを回復しました。確認情報(zipアーカイブ(LibreOfficeや他のXML-in-ZIPタイプのドキュメントを含む)、7zおよびrarアーカイブ、自動抽出exeアーカイブなど)を含むすべてのファイルを確認したいと思います。
この目標をどのように達成できますか?
ベストアンサー1
名前でファイルを探す:
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 {} \;
タイプ別にファイルを探す:
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";;
…
esac
' {} \;