Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .