Ubuntu – Unzip specific directory without creating top directory

command lineunzip

I have a ZIP file in which there is a top directory where all the files are stored:

Release/
Release/file
Release/subdirectory/file
Release/subdirectory/file2
Release/subdirectory/file3

I want to extract everything under Release, preserving the directory structure, but when I run this:

unzip archive.zip Release/* -d /tmp

It creates the top Release folder:

/tmp/Release/
/tmp/Release/file
/tmp/Release/subdirectory/file
/tmp/Release/subdirectory/file2
/tmp/Release/subdirectory/file3

How I can extract everything inside Release without creating a Release folder, like this:

/tmp/
/tmp/file
/tmp/subdirectory/file
/tmp/subdirectory/file2
/tmp/subdirectory/file3

Best Answer

In your case, try in target folder:

ln -s Release . && unzip <YourArchive>.zip

Than you need to remove the link you've created:

rm Release
Related Question