Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a zip file, and would like to unzip a subdirectory of it to another subdirectory, overwriting all existing files. How can this be done in Linux?

Example: The zip file hi.zip has a "me" folder in it. I would like to extract only the files/folders inside "me" to a folder on the system named "/home/zzz/". However, "/home/zzz/" already has files in it with the same names. I'd like to replace those with the new ones in the hi.zip file.

share|improve this question
    
In the future consider using unix.stackexchange.com. –  Caleb Apr 21 '11 at 8:53

1 Answer 1

unzip -o hi.zip me/\* -d /home/zzz

should do the trick. I suggest you test it first to make sure you don't overwrite the wrong files.

share|improve this answer
    
This does not work for me; the top directory in the zip file is copied to the destination directory. –  August Karlstrom Dec 1 '11 at 17:24

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.