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

醉酒当歌 提交于 2019-12-08 16:29:28

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/26212123/how-to-unzip-into-specific-directory-without-recreate-all-the-path-with-bash-scr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!