Run-script-before-required: list items in a backup

Hi,

I use Duplicati for backup of my Nextcloud server (Linux) and I am very happy with this excellent backup tool. As backup target I use my Backup-Server (ssh-keyfile based).

I am using the “advanced option” “run-script-before-required”. The (Perl) script called works quite fine.

Specifically in the “BEFORE” “restore” case I look for a way to list the items (directories, files) of the backup which is about to be restored ( DUPLICATI__LOCALPATH indicates only the subset of items chosen for restore).

Could anyone give me a hint? I could not find an answer in the Forum.

Regards,
P.F.B.

1 Like

Before starting the backup, the only information known to Duplicati is essentially the user input.
In this case the DUPLICATI__LOCALPATH information is the paths chosen to be restored.
The actual paths to be restored are not known before the database is consulted or a remote filelist is retrieved.

The scripts were originally designed to set up various things, such as mount a folder, fetch credentials etc. For this reason the scripts run before any interactions and this limits the information that can be obtained.

If you want to get the list of files to be restored, you could try to launch the Duplicati.CommandLine.exe / duplicati-cli program and pass the database, restore paths and filter properties. I think it will be error prone to do generally, but if you have some specific limited inputs that you need and can live with the results not being 100% accurate, then maybe you can work around it this way.

Hi P.F.B.,
You can follow this simple way to list the items that will be restored before the actual restore happens.

  • Use the Duplicati Command Line
  • Find Your Backup
  • List Backup Items
  • Filter the List
  • Run and Test the Script

This will help you see which files and directories are about to be restored. If you need more help, check the Duplicati forum or documentation.

Thanks

Hi ,

thank you for the answer!

I understand the intention of “BEFORE” actions and the limits of what information can be obtained in this actioin.

I had considered running duplicati-cli with appropriate commands.
Potential problem : I would have to parse their output, but will the output format stay the same?

Best regards,
P.F.B.

Thank you for your answer!

Please c.f. my answer to kenkendk.

Best regards
P.F.B.

Hi again,

in the Duplicati GUI, when you choose “Restore files…” of a given Backup configuration the GUI presents the backup set and lets the user choose the items to restore.

Afterwards in the “BEFORE” “restore” action these items are presented as value of the special environment variable DUPLICATI__LOCALPATHS.

Would it be a great deal to add one more such environment variable , say

DUPLICATI_BACKUP_SOURCES

whoose value would be what the Backup configuration’s exported duplicati-config.json shows as “Backup”/“Sources” ?

Regards,
P.F.B.

It is not written to be machine-parseable, but it has not been modified in the last few years.

No, it is rather trivial to add. Feel free to create an issue so we can track it.