简体   繁体   English

如何在不使用bash脚本重新创建所有路径的情况下解压缩到特定目录

[英]How to unzip into specific directory without recreate all the path with bash script

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. 在我的ios应用程序中,我需要将放在/ var / mobile / Library / Preferences / xxx中的存档解压缩到例如/ 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/... 在tmp文件夹中,有所有归档路径:/ 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 ? 我怎么能只为/ var / mobile / Library / Preferences / tmp / archive / ...而不是所有存档路径进入目标目录?

Thanks in advance 提前致谢

尝试使用-j选项unzip将目录结构展平并将所有文件写入当前目录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM