如何递归解压缩嵌套的ZIP文件? [英] How do I recursively unzip nested ZIP files?

查看:287
本文介绍了如何递归解压缩嵌套的ZIP文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

鉴于在嵌套的ZIP文件内部存在一个秘密文件,即zip文件内部的zip文件内部的zip文件,等等...

Given there is a secret file deep inside a nested ZIP file, i.e. a zip file inside a zip file inside a zip file, etc...

zip文件名为 1.zip 2.zip 3.zip 等...

The zip files are named 1.zip, 2.zip, 3.zip, etc...

我们不知道zip文件的嵌套深度,但是可能是数千个.

We don't know how deep the zip files are nested, but it may be thousands.

最简单的方法是遍历所有对象直到最后一个读取机密文件?

What would be the easiest way to loop through all of them up until the last one to read the secret file?

我最初的方法是递归调用 unzip ,但是我的Bash技能有限.您有什么解决办法?

My initial approach would have been to call unzip recursively, but my Bash skills are limited. What are your ideas to solve this?

推荐答案

感谢赛勒斯!主向导Shawn J. Goff为此拥有了完美的脚本:

Thanks Cyrus! The master wizard Shawn J. Goff had the perfect script for this:

while [ "`find . -type f -name '*.zip' | wc -l`" -gt 0 ]; do find -type f -name "*.zip" -exec unzip -- '{}' \; -exec rm -- '{}' \;; done

这篇关于如何递归解压缩嵌套的ZIP文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆