You are right, you can use the COMPARE command to generate a list of all file differences between two backup snapshots.
I would use the --run-script-after option and point it to a batch file. The batch file does not need to contain your encryption passphrase or your credentials to the back end as the comparison is done using the local database only.
Here’s a Windows batch file that might help you get started:
if not "%DUPLICATI__OPERATIONNAME%" == "Backup" exit 0
"C:\Program Files\Duplicati 2\Duplicati.CommandLine.exe" compare file://blah 1 --dbpath="%DUPLICATI__dbpath%" --full-result > "%DUPLICATI__backup_name%.log"
You can leave the storage-url set to file://blah - it’s not actually used by the compare command, but it is still a required parameter.
It will save a backupname.log file in the same location as the batch file. You could add a timestamp to the log filename without too much trouble if you wanted to keep each log instead of overwriting each time. (But you’d want to clean them out regularly so they don’t build up…)
It won’t email the log though. I don’t think there’s a way to have Duplicati include file attachments in its email notifications.
I’m using the special duplicati environment variables to avoid hard coding any info into the script. If you have multiple jobs you could use this one script in the global --run-script-before option instead of setting it on each individual job.
I haven’t actually tested the above script but I think it’ll work. It’s a starting point at least.
Now that you got a report, you could experiment to see if Duplicati can send it with send-mail-body where the run-script-after builds the compare report and feeds it in as a template (and I hope things run in that order…).
Beware of filenames that happen to look like things-between-percent-signs that would be substituted away…
Did you supply it on the command line in the --passphrase option? Options are not automatically obtained from any GUI job you might have. You need to supply all the needed ones, typically a subset of all of them.
GUI Commandline also carries in all the options, so you can just change “Command” and remove proven-harmful mismatches with syntax for The COMPARE command. I cut mine down to what was suggested, adding only --passphrase, and it worked. I even tested with and without a 1 on the line that might be extra.
I can get this if I don’t supply the --dbpath (a user error). Listing remote folder tries but it’s not there.