After performing a backup of a couple of directories like so:

# duplicity\
 --exclude /home/user/Documents/test1/file\
 --include /home/user/Documents/test1\
 --include /tmp/test2\
 --exclude '**'\
 / file:///home/user/Backup

I wanted to test how the restoration works by deleting the backed up directories:

# rm -rf /home/user/Documents/test1 /tmp/test2

And then, restoring the backup,

# duplicity file:///home/user/Backup /

But I got the error,

Restore destination directory / already exists.
Will not overwrite.

So it appears that I can't restore to the original destination without emptying the root folder even though the destination of these included folders have already been cleared.

Is there a better way than to restore it to another location and then moving each folder one by one?

# duplicity --file-to-restore home/user/Documents/test1 file:///home/user/Backup /home/user/Restore1
# mv /home/user/Restore1/home/user/Documents/test1 /home/user/Documents/test1
# duplicity --file-to-restore tmp/test2 file:///home/user/Backup /home/user/Restore2
# mv /home/user/Restore2/tmp/test2 /tmp/test2

It's really easy - use the --force flag.

duplicity --force file:///home/user/Backup /

This will probably not only restore missing files to the directories you've backed up, but also replace newer versions of backed up files if they exist, but it's better than nothing.

  • Indeed, setting the --force flag works. I wonder why the man page does not document this behaviour for the restore option. It saves me the additional step of having to rsync from a different location. Thanks! – Question Overflow Sep 7 '14 at 8:57
  • Note that even with the --force flag, Duplicity will NOT delete files in / that are not present in the backup. Tested in Ubuntu 18.04LTS + Duplicity 0.7.17 – bernie Aug 6 '19 at 7:10
  • deja-dup (a gui for duplicity) provides a "--restore-missing" parameters. Duplicity command line should have the same to avoid extracting everything. – user1767316 Jan 4 at 1:25

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.