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.

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

..\foo\foo_file1.txt
..\foo\foo_file2.txt

New zip file would have this file

..foo\foo_file1.txt

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

..\foo\foo_file1.txt
..\foo\foo_file2.txt
share|improve this question

migrated from stackoverflow.com Nov 5 '11 at 9:26

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

2  
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

1 Answer 1

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

Your Answer

 
discard

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