Linux – how to specify the unzip target directory

linuxzip

Is there an option on linux zip command such that I can hard code the target directory it unzips into. For example, I would like to zip ./mydir files into myzipfile.zip but I want the unzip command to create a specific directory "projx" and expand the files which were under ./mydir to it.

zip -r myzipfile.zip mydir (-option to expand into 'projx' when unzipped? )

Best Answer

There is no such option, at least not for Info-ZIP. You have to create a directory projx yourself, move/copy your files into it and then pass it to zip.

If the directory already exists then just pass option -d to unzip to specify the target directory for extraction.

Related Question