Cobian backup: Restore incremental backups

If you are using Cobian backup to backup your files and you have selected incremental as strategy you will find that the restore process could be a very long task if you do it manually, file by file.

You should start by older files and then continue with the inmediatily next file by date, overwriting previous files if were the case. That is the key, newer files must overwrite older backed-up files.

Today I have to restore a very very very long incremental backup, two years of daily incremental backups and only one full backup. That is 730 file backups. Furthermore the files are zipped.

Cobian backup incremental files to restore
Only one page of Cobian backup incremental files to restore as a sample


It will be great if we could do this with a script, isn´t it?

So let’s do it. We will use the following commands:

  • dir, to get a list of the files sort by name (that really means by date because of the naming pattern cobian uses)
  • 7-zip, to uncompress the files to a specific folder (you could use other tools like winrar)
  • for, a windows scripting tool to loop between items

To make things easier we will open a cmd window and we will get into the folder where the backed files are (d:\temp in my case).  The destination folder in will be d:\restored. The full command is:

for /f “delims=” %a in (‘dir /b/on’) do 7z x “%a” -od:\restored -aoa


  • dir /b/on:
    • /b parameter: shows only file names, no other summary info
    • /on parameter: Order by name, older files will be procesed first
  • for /f “delims=” %a in (list_of_files) do (uncompress_file)
    • /f parse the output of dir
    • “delims=” set a delimiter, nothing in our case
    • %a, will be the file name in each loop
    • in (), will be the full list of files got by dir command
    • do (), will be the command to apply at each file, 7-zip in my case
  • 7z e %a -od:\restored -aoa
    • x, extract files with its original folder structure
    • “%a”, the filename provided by for
    • -od:\restored, the destination folder
    • -aoa, options to overwrite any existing file. As we are extracting in order, newer files will overwrite older files.

Note: 7z.exe must be in your path variable or you should call with its full path. I added 7z to my PATH variable with:
set PATH=%PATH%;C:\Program Files\7-Zip