unzip in current directory while preserving file structure

unzip myfile.zip extracts files in the working directory by keeping path names from the zip file.

So if you get a subdirectory myfile it means it is part of the relative path of compressed files. Check it by listing the zip content

unzip -l myfile.zip

So you can unzip the file from the directory above, or, from the target directory unzip with -d option, where -d is the directory above

cd myfile
unzip myfile.zip -d ..

Leave a Comment