Ok i need to extract a zip archive named 'example.zip' but i would like to extract it as a different file name, not 'example' being my folder name, how could i extract a zip archive using unzip called 'example.zip' and extract it as the folder name 'examplefold'

2 Answers 2


By default, unzip extracts the content of the archive directly into the current directory.

You can specify a different target directory where to extract the files using the -d option:

unzip example.zip -d /path/to/wherever/you/want/the/archive/to/get/extracted

Or if the archive itself contains a folder example which you want to extract to the current directory, but with a different name, you must manually rename it to examplefold afterwards:

unzip example.zip && mv example examplefold
  • 7
    if there exists a example folder already then does this work?
    – alhelal
    Sep 15, 2017 at 3:17

Assume that you have some zip files with these names:

2.zip, 25.zip, 45.zip, ..., 10352.zip

Also, in each zip file there is a folder which is called tmp. I will write a bash file (say zz.sh) with this content:

for zipName in 2 25 45 65 85 110 264 1000 10352
    unzip $zipName.zip
    mv tmp tmp_$zipName 

Then run the file by:

bash zz.sh

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.