Hello.I just started using Duplicati (126.96.36.199_beta_2018-04-02) earlier this week on a Mac (OS version 10.12.6).
I created and successfully ran a backup to an SFTP destination. I can use the web interface and the restore function to browse through the backup and find and restore the files I’m looking for.
Now here’s the main question: I’m looking for a way to search for a specific character string across ALL of the backups. How do I do that?
Going through the forum, it looks like I should be able to through the command line, but I haven’t been able to make it work.
Here’s the syntax I used:
/Applications/Duplicati.app/Contents/MacOS/duplicati-cli find sftp://“location of the backup” “the fully resolved path of the file”
(where the fully resolved path is /Users/name/Folder/file.docx)
When I enter the command, it asks me for the encryption passphrase, which I enter and it accepts.
Then I can see the mono-sgen64 process running at 100%. I’ve let it run for upto 30 minutes, but it doesn’t return a result.
When the fully qualified path and the exact filename is specified, shouldn’t it return the result right away?
Am I doing something wrong or there something else I’m missing or the CLI isn’t working correctly?
Thanks in advance,
Hello @asood, welcome to the forum!
I need a little clarification on two points:
- Are you looking for the specific character string in the file names or the file contents?
- When you say “across ALL backups” do you mean across all versions of a particular backup job or across multiple backup jobs?
You can do this by invoking the commandine tool from the GUI.
- Click the backup job name to open its details and click Commandline.
- Select the
Find command from the drop-down menu.
- Delete everything from the
Commandline arguments text box and replace it with a search filter, for example
*testfile* will find
C:\Folder\Testfile.txt and D:\Folder\Subfolder\This is another testfile from me.docx`.
- On the next line in the same text box, type
--all-versions. Alternatively, you can select
all-versions from the Advanced options list at the bottom of the page and click to select the checkbox.
- Click the Run “find” command now button at the bottom of the page.
I’m using a Mac. I followed the steps you outlined, but it doesn’t work. (I tried with and without the --allversions with the same results)
Here’s a couple of screen shots. I’m looking for a file called Gartner Reprint.pdf.
The first screen is from the standard search function.
The second shows the commandline search as you described.
And the third shows the top portion of the results which is none found.
Does it have something to do with it running on Mac?
Am I doing something wrong or missing something obvious?
It sounds like Kees-z’s solution should do what you want (and no, there isn’t a way to search file contents at this point).
I’m not sure why it’s not working as expected, your screen shots look ok to me (unless you’ve got something odd in your advanced settings).
I don’t see this option anywhere in your screenshots. What is the exact syntax you used? The correct command line option is
Remember to put
--all-versions on a new line if you type it into the Commandline arguments text box.
The images I posted did not include the --all-versions option. With those I simply wanted to test if it worked without searching all versions of a single backup set.
I ran the same command again with the --all-versions options and got another error.
In the commandline I entered Gartner*, then on a new line entered --all-versions
Here are the screen captures of the command and then results. Still getting an error and I’m not sure if it’s a bug or maybe my unfamiliarity with Duplicati. Thanks again for your assistance.
@kees-z I got it to work. I had to change a couple of things.
- On the commandline window, I had to leave the original directory path and append the search string to it.
- I had to delete (by clicking the x) the compression-module, default-filters, disable-module and exclude-files-attributes options and then run the find.
Thanks again @kees-z for your help.
*Gartner* instead of
Gartner*. Wildcards apply to the complete path, not only the filename.
@kees-z that worked.
Along the same lines, now that I can find the files, is there a way to restore all of the versions in a single command (instead of each version individually)?
Not that I’m aware of.
As a workaround, you could restore the file from a loop in a script that calls the commandline tools, something like:
for /l %%a in (0,1,10) do (
duplicati.commandline.exe restore <storage-url> "<filename>" --restore-path=<path> --overwrite=false --version=%%a
%%a from 0 to 10 and calls the Restore command using version
If you want to keep it simple:
duplicati.commandline.exe restore <storage-url> "<filename>" --restore-path=<path> --overwrite=false --version=0
duplicati.commandline.exe restore <storage-url> "<filename>" --restore-path=<path> --overwrite=false --version=1
duplicati.commandline.exe restore <storage-url> "<filename>" --restore-path=<path> --overwrite=false --version=2
duplicati.commandline.exe restore <storage-url> "<filename>" --restore-path=<path> --overwrite=false --version=10
Thanks for the suggestions @kees-z. I will try it.