[英]How to unzip all zip folders in my subdirectories?
My folder structure 我的文件夹结构
drwx------ 2 miki miki 4096 сеп 12 2018 Chapter03/
drwx------ 2 miki miki 4096 сеп 12 2018 Chapter05/
drwx------ 2 miki miki 4096 сеп 12 2018 Chapter07/
drwx------ 2 miki miki 4096 сеп 12 2018 Chapter09/
drwx------ 2 miki miki 4096 сеп 12 2018 Chapter10/
drwx------ 2 miki miki 4096 сеп 12 2018 Chapter13/
drwx------ 2 miki miki 4096 сеп 12 2018 Chapter14/
-rw-r--r-- 1 miki miki 96 сеп 12 2018 README.txt
Each chapter contains on ore more zip folders. 每章都包含更多的zip文件夹。 I tried this way 我这样尝试
unzip -d $(find ./ -type f -name '*.zip')
This does not work. 这是行不通的。
Archive: ./Chapter14/kops-master.zip
4ffc8d76f1313a2f2a04a87d543a0701816c3df7
checkdir: cannot create extraction directory: ./Chapter14/weave-kube-master.zip
File exists
How should the proper command look like? 正确的命令应如何显示?
Try: 尝试:
find . -type f -name '*.zip' -exec unzip {} \;
This runs unzip
on each zip file found by your find
command. 这会对您的find
命令找到的每个zip文件运行unzip
。
The above will work even if the zip files or directories have spaces or other difficult characters in their names. 即使zip文件或目录的名称中包含空格或其他困难字符,上述方法也将起作用。
Since zip files may contain/nest zip files, and we do not know the order of files reading in the find
command. 由于zip文件可能包含/嵌套zip文件,因此我们在find
命令中不知道文件读取的顺序。 It is better to run find
command twice, or 3 times. 最好运行find
命令两次或3次。 Corresponding to the zip nesting level. 对应于zip嵌套级别。
find . -type f -name '*.zip' -exec unzip {} \;
find . -type f -name '*.zip' -exec unzip {} \;
find . -type f -name '*.zip' -exec unzip {} \;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.