Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have googled and searched, but can't find the command that 7zip command line utility uses for making incremental backups. So can someone please share the command ?


btw I found this link: . But it seems to be for differential backups, even though it says incremental.

share|improve this question

Should be simple, use this to create and incrementally update the archive:

7zr u -up0q3r2x2y2z1w2 {archive}.7z {path}

This page offers a reference for the update options.

They are translated as follows:
p0 - If "File exists in archive, but is not matched with wildcard" then remove the file from the archive.
q3 - If "File exists in archive, but doesn't exist on disk" then remove the file from the archive and remove it from the filesystem upon extraction.
r2 - If "File doesn't exist in archive, but exists on disk" then pack the file into the archive.
x2 - If "File in archive is newer than the file on disk" then pack the older file into the archive.
y2 - If "File in archive is older than the file on disk" then pack the newer file into the archive.
z1 - If "File in archive is same as the file on disk" then reuse the packed version of the file.
w2 - If file size is different then pack the modified file into the archive.

share|improve this answer
Hello, what do those many options mean? – Zhianc Apr 27 '15 at 7:34
It's a map from a file state to an action. There are seven possible states. – ArtemGr Apr 27 '15 at 12:06
It's not an incremental backup. This command makes a differential backup and creates new archive with changes since last full backup. Incremental backup tracks changes since previous incremental backup (diff of diff). – stil Feb 7 at 21:11

If you where to do an incremental backup, you would need to provide 7-zip with the list of the files modified (with -i@fileList), and you would need to elaborate such list somehow. At you can find some unix/cygwin command line which would use md5 signatures to create the fileList.

7-zip update operation allows to create a secondary archive with the differences (including deleted files) occurred since the base/primary archive. That is properly named a differential backup (as stated in the question itself).

I've found an excellent article on this topic at WPCTips "Differential Backups with 7-zip". They recommend either using a GUI program (Toucan), or use this recipe for the command line:

7z u {base archive.7z} {folder to archive} -u- -up0q3r2x2y2z0w2!{differential.7z}

This is a bit different from the 7zr u -up0q3r2x2y2z1w2 {archive}.7z {path} proposed by ArtemGr:

  • -u- tells the main archive should not be modified
  • -up0q3r2x2y2z0w2!{differential.7z} specifies the target differential archive, and what action to do for each file for each condition/state: add files which are new or modified in the filesystem, remove files which are only in the 7zip archive, ignore the rest.

Just in case you are curious about the specifics of that cryptic p0q3r2x2y2z0w2

<state> | State condition
p | File exists in archive, but is not matched with wildcard.   Exists, but is   not matched 
q | File exists in archive, but doesn't exist on disk.
r | File doesn't exist in archive, but exists on disk.
x | File in archive is newer than the file on disk.
y | File in archive is older than the file on disk.
z | File in archive is same as the file on disk
w | Can not be detected what file is newer (times are the same, sizes are different)

<action> | Description 
0 | Ignore file (don't create item in new archive for this file) 
1 | Copy file (copy from old archive to new) 
2 | Compress (compress file from disk to new archive) 
3 | Create Anti-item (item that will delete file or directory during extracting). This feature is supported only in 7z format. 
share|improve this answer
Thank you for the answer Javier, and welcome to Super User. There is a policy here of summarising links in case they disappear- could you explain how the command achieves the incremental backup? (particularly the up0q3r2x2y2z0w2 part!) Thanks :-) – bertieb Aug 2 '15 at 18:48
@bertieb thank you for advice. I hope it is more clear now. – Javier Aug 2 '15 at 19:25
Thanks for the edit, have a +1 :) – bertieb Aug 2 '15 at 20:25
Could you clarify if I need to extract each intermediate differential backups in order to get to the desired state? - is 7zip smart enough to do this for me? – Daniel Sokolowski Feb 11 at 22:06
@DanielSokolowski Not sure if this answers your question. If you did an incremental backup (A+b+c+d), you will have to extract from each archive in the order you made them. If you did a differential backup (A+(b+c+d)). It is 2 archives you have to extract. It would be nice that the last archive contained information about previous archives and order of extraction, so extraction could be made with a single command. But I am not aware of such feature. – Javier Feb 17 at 18:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .