Synchronizing files using 7-Zip and the CLI

On the command line, 7-Zip has the command 'a' to "Add files to archive". But I want to synchronise the files instead. This is one of the main options in the GUI, but the CLI has disregarded it for some reason.

How can I do this? An example would be appreciated.

2 Answers

Using some info I found online, I figured out that -uq0 is the switch you probably want. Here's an example of an update script I just tested out based on this:

"C:\Program Files\7-Zip\7z.exe" u "C:\Users\dane\Documents\Docz.7z" -uq0 "C:\Users\dane\Documents\*" -r -x!*.7z -ssw -ms=off

I tested this out and it removed a file from the archive after I deleted the file.

3

Use the 'u' operator (update)

Slightly edited snippit from a backup job I run:

7z.exe u Documents.7z ".\Documents\*" -r -x!*.7z -x!*.pst -t7z -ssw -mx=3 -m3=LZMA2 -mmt=2 
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like