I have a file called All CRGs.zip
and I want to unzip its contents into a directory called data
(which already exists and has some other files in).
Is this possible? I'm working on OSX.
I've tried:
$ unzip "All CRGs.zip" -d data/
But this unzips everything into data/All CRGs
which is not what I'm looking for. I'd like everything to go straight into data
.
Is this possible?
Best Answer
You can either recreate the complete folder-structure including the
All CRGs
-Folder or you can ommit all folders inside the ZIP-file by using the-j
-flag for the unzip-command.The problem is that the ZIP-file has been created using the
All CRGs
-Folder as top-level likezip "All CRGs.zip" "All CRGs"
. The correct way would have beenzip "All CRGs.zip" "All CRGs/*"
which would have created a ZIP-Archive of all the files and folders inside theAll CRGs
-folder without the surrounding folder.So the only way to extract only the files by retaining the folder-structure would be something like this:
It will unzip the complete folder and after that move the content of the folder up one level and finaly remove the (now empty) "All CRGs"-folder.