I have a folder like this:
-resources
--graphics
--sounds
I want to zip graphics and sounds folder into a .zip file named resources.zip, which I will use
zip -r resources.zip graphics/ sounds/
but when I unzip resources.zip, under /home/me, it will be like this:
-home
--me
---resources
----graphics
----sounds
I don't want the resources folder created when unzipping, can I do anything when zipping to achieve this?
Best Answer
Yes, that's the default behaviour of
unzip
. Unfortunatly there is no way to selectivly ignore the original path of the zipped files. You can, however, tell unzip to ignore any path:unzip -j resources.zip
which would unzip all files into the $pwd. That's probably not what you want. You can achieve your desired result by zipping like this:
zip -j resources.zip ~/resources/*
This will create a zip-file that saves all files and directories in ~/resources/ but will junk the path ~/resources/, so on extraction you will only get sounds/ and graphics/.