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"'