Avoid unwanted path in Zip file
Posted
by jerwood
on Super User
See other posts from Super User
or by jerwood
Published on 2010-03-14T01:30:53Z
Indexed on
2010/03/14
1:35 UTC
Read the original article
Hit count: 398
I'm making a shell script to package some files. I'm zipping a directory like this:
zip -r /Users/me/development/something/out.zip /Users/me/development/something/folder/
The problem is that the resultant out.zip archive has the entire file path in it. That is, when unzipped, it will have the whole "/Users/me/development/anotherthing/" path in it. Is it possible to avoid these deep paths when putting a directory into an archive?
When I run zip from inside the target directory, I don't have this problem.
zip -r out.zip ./folder/
In this case, I don't get all the junk. However, the script in question will be called from wherever.
FWIW, I'm using bash on Mac OS X 10.6.
© Super User or respective owner