如何从Unix命令行递归解压缩目录及其子目录中的压缩文件?

unzip命令没有递归解压缩归档的选项。

如果我有以下目录结构和归档:

/Mother/loving.zip
/Scurvy/Sea Dogs.zip
/Scurvy/Cures/Limes.zip

并且我想将所有的归档解压到与每个归档具有相同名称的目录中:

/Mother/loving/1.txt
/Mother/loving.zip
/Scurvy/Sea Dogs/2.txt
/Scurvy/Sea Dogs.zip
/Scurvy/Cures/Limes/3.txt
/Scurvy/Cures/Limes.zip

我会发出什么命令?

重要的是,这不会阻塞在其中有空格的文件名。

如果你想提取文件到相应的文件夹,你可以试试这个
find . -name "*.zip" | while read filename; do unzip -o -d "`dirname "$filename"`" "$filename"; done;

可处理高I / O的系统的多处理版本:

find . -name "*.zip" | xargs -P 5 -I fileName sh -c 'unzip -o -d "$(dirname "fileName")/$(basename -s .zip "fileName")" "fileName"'

相关文章

用的openwrt路由器,家里宽带申请了动态公网ip,为了方便把2...
#!/bin/bashcommand1&command2&wait从Shell脚本并行...
1.先查出MAMP下面集成的PHP版本cd/Applications/MAMP/bin/ph...
1、先输入locale-a,查看一下现在已安装的语言2、若不存在如...
BashPerlTclsyntaxdiff1.进制数表示Languagebinaryoctalhexa...
正常安装了k8s后,使用kubect工具后接的命令不能直接tab补全...