How to mount or look inside of a snapshot to find a specific file and restore just that file, from CLI

Hi, I’m curios how I can search for a specific file/folder in your repository/snapshot and restore just that one through the cli?

both Kopia and Borg/Vorta can mount the repos so you can find just what you need and restore it.

Yes, I have search the forum and www and have not found a complete answer, if it’s even possible? I hope it would be since you can do it through the web-gui.

list, list -files, and restore; use path to the file you want to restore as filter.

1 Like

aha, thank you, I will try it when the backup is done.

you don’t have to wait. duplicacy is fully concurrent.

I could not get that to work, if I type duplicacy list -files
I get this output:

 798486 2025-10-28 13:09:59 3b04dfee2189521eb726aae74228320c9a9cde8007c2c00ceb908552e9448f6c Downloads/darkreader-chrome-mv3.zip
       387 2026-02-08 16:54:59 7999b30dd7ecc1c4df5c4ac1b180538a937c3fea2fdf9a481324ad5851dc20e0 Downloads/home_assistant_backup_emergency_kit_2_8_2026_4_54 PM.txt
    140420 2026-02-08 11:22:25 a11af562eb0325bf91ddb254ba9355803ebf03672678a63db1154036e2b026db Downloads/hs_err_pid46428.log
       448 2025-03-23 10:13:12 2d401f6e3b924929a1fae713bb2506b21c6fdc78357c8f264f96bcf10fab6605 Downloads/install-docker.sh

Lets say I wanted to restore only the “install-docker.sh” file, how would that syntax look?
I tried:

duplicacy restore Downloads/install-docker.sh
duplicacy restore 2d401f6e3b924929a1fae713bb2506b21c6fdc78357c8f264f96bcf10fab6605/Downloads/install-docker.sh
it does not work for me.

I probably going to end up buying the web-gui but I would like to be able to use just the CLI as well in case of emergency.

WebUI is a frontent on top of duplciacy CLI. It cannot do more than CLI can.

Did you read the restore command manual?

duplicacy restore [command options] [--] [pattern]

so, in your case, assuming storage name is “default” (otherwise add -storage frag):

duplicacy restore  -r <revision> -- "Downloads/install-docker.sh"

I did read it, but clearly I did not understand it.
I managed to make it happen with your help, so thank you!
Same as the “backup to multiple storage’s” where it says super easy. That section does not look “super easy” if you having to make dummy directories, ect.
If you know of any video tutorials that are good, on backing up to multiple storage’s. It would be highly appreciated.

I don’t think you need to mess with dummy directories; or need a video tutorial.

Here is a quick tutorial for you:

Setup dummy repository and two storages

% mkdir /tmp/{data,storage1,storage2}

% cat >> /tmp/data/file.txt <<EOF
heredoc> Hello!
heredoc> This is a test file!
heredoc> EOF

% cd /tmp/data
% ls
file.txt

Init repository and add first storage. if you don’t specify storage name – the name will be “default”, so I always specify.

% duplicacy init -storage-name storage1 snapshot1 /tmp/storage1
/tmp/data will be backed up to /tmp/storage1 with id snapshot1

Add second storage:

% duplicacy add storage2 snapshot2 /tmp/storage2
/tmp/data will be backed up to /tmp/storage2 with id snapshot2

Everything is written into .duplicacy/preferences file. You can edit stuff there – like, rename storage for example.

% cat .duplicacy/preferences
[
    {
        "name": "storage1",
        "id": "snapshot1",
        "repository": "",
        "storage": "/tmp/storage1",
        "encrypted": false,
        "no_backup": false,
        "no_restore": false,
        "no_save_password": false,
        "nobackup_file": "",
        "keys": null,
        "filters": "",
        "exclude_by_attribute": false
    },
    {
        "name": "storage2",
        "id": "snapshot2",
        "repository": "",
        "storage": "/tmp/storage2",
        "encrypted": false,
        "no_backup": false,
        "no_restore": false,
        "no_save_password": false,
        "nobackup_file": "",
        "keys": null,
        "filters": "",
        "exclude_by_attribute": false
    }
]%

Now backup to first storage:

% duplicacy backup -storage storage1
Storage set to /tmp/storage1
No previous backup found
Indexing /tmp/data
Parsing filter file /tmp/data/.duplicacy/filters
Loaded 0 include/exclude pattern(s)
Packed file.txt (28)
Backup for /tmp/data at revision 1 completed

Backup to second storage:

% duplicacy backup -storage storage2
Storage set to /tmp/storage2
No previous backup found
Indexing /tmp/data
Parsing filter file /tmp/data/.duplicacy/filters
Loaded 0 include/exclude pattern(s)
Packed file.txt (28)
Backup for /tmp/data at revision 1 completed

That’s it…

If you want to be able to copy between two storages, when creating second storage make sure to make it copy-compatible. See add command’s manual. e.g. duplicacy add -help

1 Like

Thank you, I will try that, and see if I can get it to work for me:)