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.

Is there a way to unzip a .zip to a folder and sync the contents of that folder with the contents of the .zip?

I know you can do an -u(pdate) option that will update the folder with newer files, but that's not good enough. I need it to do an actual sync (remove files not present in the .zip, and update files that are newer).

It also needs to be fast, since I'll be sync'ing large .zips. So, a wipe plus clean unzip is not an option.

I'm open to any tool that will do the job. But it has to work unattended from the command line.

share|improve this question
add comment

2 Answers 2

up vote 0 down vote accepted

WinZip has a Command Line Support Add-On named WZUNZIP.EXE with the following option which can be used in combination with its -e argument when extracting:

-n -- Unzip only newer files. This option updates existing files if the archived file is newer and creates new ones if they do not already exist.

share|improve this answer
    
Yes, this is similar to unzip.exe -u option. It only updates, it doesn't do a full sync. I need it to remove files from the folder if they don't exist in the .zip. –  fasteddo Apr 26 '12 at 20:02
    
Check out SynchronEX. –  martineau Apr 26 '12 at 21:09
    
Wow, thanks. SynchronEX appears to fit the bill. However, for this project I need something free. Sorry for not mentioning that in the original post. I don't mind marking it as answered if that's the only option. –  fasteddo Apr 27 '12 at 4:33
    
@fasteddo: Sorry, I'm not aware of anything free at this time. You could probably roll your own in, for example, the (free) Python language which has built-in .zip file support, however, at only $20, SynchronEX looks like a bargain. –  martineau Apr 27 '12 at 13:50
    
Ya, it's not the money, it's the nature of the project. Thanks for your suggestions! –  fasteddo Apr 27 '12 at 16:59
add comment

I searched for something which had this capability for quite some time myself. The Info-ZIP utility is free, command line based, and has an -FS switch that will remove files from the archive which no longer exist in the source folder in addition to updating newer files. I.E. ZIP file synchronization. http://www.info-zip.org/ Note: The only issue I have with this utility, is that there is no facility for explicitly specifying the source folder as part of the command line arguments. It uses the current working directory as the source. So in a script, you would use the CD command to first change to the source directory and then initiate the ZIP command. For example:

CD /D D:\Program Settings\Favorites
zip -FS -r -9 -b %Temp% -q -ds 0 "D:\Backup\Favorites.zip" .
share|improve this answer
    
Unfortunately this does just the opposite of what the question asked for. And there does not seem to be an appropriate switch to have a zip as a source and a folder as a destination. :-( –  hstoerr Nov 7 '12 at 15:01
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.