Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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, when I run unzip -l I get the following output.


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 again I get something like this


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


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.