Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

How can I Unzip a Zip file which contains different directories and sub directories with the overwrite mode ?
I mean i want the zipped contents to overwrites any existing files (be it old be it new). I have read about Unzip command , but it seems it doesnt overwrite any sub directories.

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

When doing something like this it will never replace the directory if it exists, it will create any files in the directory that do not already exist and replace any files that do.

Effectively it combines/updates the directory.

Without rming the directory prior to unzipping I'm pretty sure you cannot achieve what you are trying to do.

The overwrite all mode you are referring to (-o) will simply overwrite files without asking.

share|improve this answer
    
I don't want the directories or sub directories to be recreated, i want their files to be replaced.any luck now? –  Hossein Oct 3 '12 at 19:43
1  
as h3rrmiller said, as long as you are not deleting anything, when you extract the zip file at the base of the tree where it was created, it will by default overwrite existing files, create files and directories that didn't exist and and ignore anything that was already there but it didn't have within the archive. –  Drahkar Oct 4 '12 at 11:45
1  
@Hossein Directories wont be overwritten with the unzip process (or any inflation process). only files. any directories that already exist will be "updated". –  h3rrmiller Oct 4 '12 at 12:36
add comment

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.