Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Let us assume I have a zip file called patch.zip, when I run unzip -l patch.zip I get the following output.

bin/a
bin/b
lib/c

To this zip file I want to add a new file, "Readme.txt" located at /path/to/Readme.txt in such a way that, when I re-run unzip -l patch.zip again I get something like this

bin/a
bin/b
lib/c
doc/Readme.txt

Any help would be appreciated.

share|improve this question

2 Answers 2

up vote 0 down vote accepted

I don't think there's a way to specify the pathname files should have within the zip-file, so you can't say "store /var/tmp/Readme.txt" as doc/Readme.txt".

You would have to create the directory layout on disk first, as a sort of staging area:

mkdir doc
cp -p /path/to/Readme.txt doc
zip foo.zip doc/Readme.txt
share|improve this answer
    
@njd: Thanks a lot for your answer. –  cx0der Feb 6 '10 at 2:03

I just recreate the zip file. I know it might not be the solution you need, but it is a very simple solution. I've also found issues with messing with zip file contents while still compressed so found this method to be more reliable.

share|improve this answer
    
@Insomnic: Thanks a lot. –  cx0der Feb 5 '10 at 21:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.