Linux unzip解压多个文件

时间:2021-07-01 11:49:48

假设当前目录下有多个zip文件

data.zip invoices.zip pictures.zip visit.zip,

直接

unzip *.zip

等价于

unzip data.zip invoices.zip pictures.zip

会报错

Archive: data.zip

caution: filename not matched: invoices.zip

caution: filename not matched: pictures.zip

caution: filename not matched: visit.zip

因为会认为后面三个zip文件是在第一个zip文件里面的,因此需要

unzip '.zip’

或者

unzip "
.zip"

或者

unzip *.zip

来屏蔽掉linux的通配符(man可以看到Be sure to quote any character that might otherwise be interpreted or modified by the operating system, particularly under Unix and VMS.)

或者

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

refer:

  1. https://www.cyberciti.biz/faq/linux-unix-shell-unzipping-many-zip-files/
  2. https://askubuntu.com/questions/564607/unzip-multiple-files

原文:https://blog.csdn.net/jaye16/article/details/74978408