How to unzip to a specific directory without re-creating the entire path using a bash script

In my ios application, I need to unzip the archive, which is placed in / var / mobile / Library / Preferences / xxx in, for example, / var / mobile / Library / Preferences / tmp.

My problem is when I run this:

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

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

How can I use only / var / mobile / Library / Preferences / tmp / archive / ... and not the entire archive path to the target directory?

Thank you in advance

+6
source share
1 answer

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

+7
source

Source: https://habr.com/ru/post/976288/


All Articles