简体   繁体   English

如何解压缩子目录中的所有zip文件夹?

[英]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.

相关问题 解压终端所有子目录下的所有gz文件 - Unzip all gz files in all subdirectories in the terminal 使用python压缩所有子目录 - Zip all subdirectories using python Python zipfile不会解压缩Windows zip存档的文件夹 - Python zipfile does not unzip folders for windows zip archive 递归解压所有子目录,同时保留文件结构 - Recursively unzip all subdirectories while retaining file structure unix unzip:如何批量解压缩文件夹中的zip文件并保存在子文件夹中? - Unix unzip: how to batch unzip zip files in a folder and save in subfolders? 我们如何在linux中指定unzip或7za命令将多个zip文件解压缩到一个文件夹中,同时保留所有重复文件? - How can we specify the unzip or 7za command in linux to extract multiple zip files into one folder while keeping all duplicates? bash列出所有目录,子目录,文件夹,子文件夹,然后输出到单独的文件 - bash list all directories, subdirectories, folders, subfolders in then output to a separate file 如何将文件复制到所有子目录? - How to copy a file to all subdirectories? 如何递归解压缩嵌套的 ZIP 文件? - How do I recursively unzip nested ZIP files? 如何在 google colab pro 中解压缩大型 zip 文件? - How to unzip large zip file in google colab pro?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM