Linux: массовое тестирование и распаковка zip архивов

Тестирование:

for z in *.zip; do unzip -t $z; done | grep unzip


Лишнего выведено не будет, но сообщения об ошибках увидим:

End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of US_basics.zip or
        US_basics.zip.zip, and cannot find US_basics.zip.ZIP, period.
unzip:  cannot find zipfile directory in one of US_basics.zip or
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of VICE_sw.zip or
unzip:  cannot find zipfile directory in one of VICE_sw.zip or
        VICE_sw.zip.zip, and cannot find VICE_sw.zip.ZIP, period.


Распаковка:

for z in *.zip; do unzip $z; done


Более изящный способ — рекурсивно найти zip файлы и каждый распаковать в директорию в которой он лежит (или протестировать):

find /где-ищем -iname "*.zip" -type f -execdir unzip {} \;


Тестирование:

find /где-ищем -iname "*.zip" -type f -execdir unzip -t {} \; | grep unzip
  • +4
  • 08 ноября 2010, 17:51
  • Sergei_T

Комментарии (3)

RSS свернуть / развернуть
+
0
OK !
avatar

Markony

  • 08 ноября 2010, 17:55
+
0
update
avatar

Sergei_T

  • 14 декабря 2010, 21:13
+
0
Тебе сюда
avatar

yababay

  • 14 декабря 2010, 22:21

Только зарегистрированные и авторизованные пользователи могут оставлять комментарии.