Ubuntu – How to restore a Déjà Dup Backup file at command prompt with duplicity

backupcommand linedeja-dupduplicityrestore

I have used Déjà Dup Backup Tool to backup to external hard disk (/media/TOSHIBA EXT/)

Now I want to test the backup. So I deleted one test file (/home/rch/hecatombe.txt).

I can restore that file via Nautilus "File => Restore Missing Files" (as at restore a backup from duplicity )

But I prefer to work at the command prompt.

So I deleted that test file again, and did this at the command prompt:

duplicity restore --no-encryption "file:///media/TOSHIBA EXT/" "/home/rch/hecatombe.txt"

But instead of restoring my file hecatombe.txt, duplicity made a new directory hecatombe.txt with contents like this /home/rch/locate_hecatombe.txt/home/rch

What am I doing wrong?

Best Answer

As you may have guessed, duplicity asks for a directory as the second argument when restoring files. According to man duplicity:

duplicity [restore] [options] [--file-to-restore <relpath>] [--time time] source_url target_directory

...
If we wanted to restore just the file "Mail/article" in /home/me as it was three days ago into /home/me/restored_file:

duplicity -t 3D --file-to-restore Mail/article
sftp://uid@other.host/some_dir /home/me/restored_file

So, in your case, you would use:

duplicity restore --no-encryption --file-to-restore hecatombe.txt "file:///media/TOSHIBA EXT/" "/home/rch/"
Related Question