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

I am having an issue with commad line unzip and am not sure how to correct this.

I am unzipping a compressed file and it processes it correctly. If the zip file should have some files removed and it uses the same directory structure. Then that new zip file is uncompressed to the same destination as previously, with the -o option. It will overwrite the newer files (that is what i want). The problem i am experencing is the files that were removed from the new zip file are still in the destination directory structure.

How can I get the directory structure to only show the files that are in the new zip file?

Original zip file would have these files


New zip file would have this file\foo_file1.txt

When the second zip file is uncompressed the directory structure would still look like this

share|improve this question

migrated from Nov 5 '11 at 9:26

This question came from our site for professional and enthusiast programmers.

It is difficult to understand what your trying to say, please restructure your question. I suggest having a peer review it with you on your end, that way they can ask questions and you can figure out exactly how to clearly ask this question. – awiebe Nov 4 '11 at 18:05

rm -rf foo before you unzip the new archive?

share|improve this answer
The zip file doesn't keep a record of what has been removed from it, so it doesn't know what to remove from the destination. You'll have to remove the folder completely before unzipping the file. Since the filenames in the example used backslahes, it's probably Windows: rmdir /s foo – Randy Orrison Nov 5 '11 at 12:55
Thanks for the clarification! – Andrew Schulman Nov 5 '11 at 16:19

You must log in to answer this question.