How to restore a single folder via CLI?


Is it possible to restore a single folder with all subfolders and files from the backup via CLI? I can’t find any command or option for this.

I’ve use Duplicati on a Linux machine.

Off the top, The RESTORE command should get you going but you’ll probably want to read the whole Using Duplicati from the Command Line manual for extra details.

You might have to feed it wildcard syntax, e.g. /path-to-folder/* but you can definitely get a folder.

You certainly can (I’m investigating myself in this very moment.). A first impression is given in duplicati-cli example:

Restore a specific file
  The following command will restore "/source/myfile.txt" from the backup in the latest version to its original destination and overwrite an existing file.

  duplicati-cli restore "/source/myfile.txt" --overwrite

(I changed mono "Duplicati.CommandLine.exe" to duplicati-cli)

duplicati-cli example also gives an example for the find command.


Welcome to the forums StefanBrand.

Yes, if you’re running MacOS or Linux then using duplicati-cli is shorter to type than mono Duplicati.CommandLine.exe but otherwise they are the exact same.

If you ran

  • duplicati-cli restore "/source/myfile.txt" --overwrite

Your computer would actually run

  • mono Duplicati.CommandLine.exe restore "/source/myfile.txt" --overwrite

Either or works.

It should probably go without saying but duplicati-cli does not exist in Windows, in the case of Windows omit the mono prefix and change the / to \, so it would be.

  • Duplicati.CommandLine.exe restore "\source\myfile.txt" --overwrite

As a test I just renamed a folder on my desktop called usb to usbStick, this folder contains multiple files and folders. I then ran the following (yes, I’m in Windows and the backups are stored in local drive D:).

  • C:\Program Files\Duplicati 2>Duplicati.CommandLine.exe restore “D:\YourCompanyBackups” “C:\Users\Jimbo\Desktop\usb\*” Note the * as the last character (a wildcard as mentioned by ts678).

About 9 minutes later the usb folder and all of it’s contents have been recreated on my desktop as expected.

Side note, I need to look into this further but it seems if your backups are unencrypted you still need to provide a passphrase, doesn’t matter what gets typed in but something has to be typed. Possibly just using the --passphrase option with a blank value may prevent it but I haven’t had a chance to test it yet.

Enter encryption passphrase:
ErrorID: EmptyPassphrase
Empty passphrases are not allowed

If I type anything in for the Enter encryption passphrase: it accepts it and performs the restore.

Hopefully this helps get people working with the CLI, oh and one last thing, a quick reminder that CLI operations are not shown or recorded in the GUI.


Nice expansion and tests. I’m afraid the manual is a bit weak. Writers are welcome.

I do little CLI, but I think I saw that no-encryption is how to indicate it’s unencrypted.

CLI operates independently, but if you’re doing both GUI and CLI and give the GUI database path to the CLI run via dbpath, then the two are connected through the database, so visibility works from either way.

You won’t get real-time CLI status in the GUI, and GUI settings don’t go to CLI. You supply all its options.

I’m not even sure if anyone had mixing in mind, but it seemed worth mentioning because some want to…

Thanks for confirming.

1 Like

Correct you are, by adding --no-encryption=true it proceeds without asking for a passphrase.

Getting a bit off topic here but…

I’m not sure why, but many people (myself included) seem to have the impression when starting with Duplicati that the CLI and GUI are inter-connected. I 100% expected that I should be able do something like Duplicati.CommandLine.exe backup "Job Name" that would launch an already defined GUI backup job with all of it’s defined options/source selection from the CLI but as far as I know, this cannot be done as is.

My powershell script gets around this for the most part by running the GUI jobs directly, it’s not perfect either but at least I can now walk a user through making a source selection/option change in the GUI with ease.

Prior to building that PS script I was going trying to schedule/batch CLI jobs at night and have users check the status in the GUI which in retrospect is doable but I’m still left with manually defined source/options for each script and knowing that 99% of users won’t know how/want to modify the script (even with written instructions) or if they did, would still manage to muck it up somehow, so for me mixing the CLI and GUI even with a --dbpath won’t really work out.

So for the above reasons I mentioned the disconnect between the CLI and the GUI.

1 Like