如何解压缩到特定目录,而无需使用bash脚本重新创建所有路径 [英] How to unzip into specific directory without recreate all the path with bash script

查看:171
本文介绍了如何解压缩到特定目录,而无需使用bash脚本重新创建所有路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的ios应用程序中,我需要将放置在/ var / mobile / Library / Preferences / xxx中的归档文件解压到例如/ var / mobile / Library / Preferences / tmp。

$ b我的问题是,当我启动:

  unzip / var / mobile / Library /偏好设定/ xxx / archive.zip -d / var / mobile / Library / Preferences / tmp / 

tmp文件夹,有所有的存档路径:/ var / mobile / Library / Preferences / tmp / var / mobile / Library / Preferences / xxx / archive /...



我如何才能做只有/ var / mobile / Library / Preferences / tmp / archive / ...而不是所有的归档路径到目标目录?



提前感谢

解决方案

尝试 -j 选项到解压缩,可以平滑目录结构并将所有文件写入当前目录。


In my ios application, I need to unzip an archive that is placed into /var/mobile/Library/Preferences/xxx into, for example, /var/mobile/Library/Preferences/tmp.

My issue is that when I launch this:

unzip /var/mobile/Library/Preferences/xxx/archive.zip -d /var/mobile/Library/Preferences/tmp/

in the tmp folder, there is all the archive path: /var/mobile/Library/Preferences/tmp/var/mobile/Library/Preferences/xxx/archive/...

How could I do for only have /var/mobile/Library/Preferences/tmp/archive/... and not all the archive path into the target directory ?

Thanks in advance

解决方案

Try the -j option to unzip which flattens the directory structure and writes all the files into the current directory.

这篇关于如何解压缩到特定目录,而无需使用bash脚本重新创建所有路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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