How to restore a specified folder from a local backup in duplicacy cli

I used duplicacy to create a snapshot id named mywork, and backed up “F:\图书馆” to “D:\白名单\不存档\duplicacy”. I want to restore the specified folder “F:\图书馆\回收箱” (there is a folder called “回收箱” at the next level of the backup folder) in “D:\白名单\不存档\恢复文件夹”, but it cannot be restored, and it shows “Loaded 0 include/exclude pattern(s)”.
how to solve it,
The software version is duplicacy_win_x64_3.2.3.exe

Try adding -- before the pattern, and putting pattern inside single quotes, to prevent shell from expanding the *.

duplicacy restore -r 1 -- 'path/path/*'

restore command

I tried, but still can’t recover

So it did work, right? It said “Restored D:… to revision 1”

If you see the message above, it does say it loaded one pattern:


Did you check that it restored the files as expected? You can delete that file, and run restore again, it shall say “Downloading the file” or something along these lines.

This is what I have tried, and it worked:

% mkdir -p 1/2/3/4/5
% echo hello > 1/2/3/4/5/hello.txt
% mkdir target
% cd 1
% duplicacy init test /tmp/target
/tmp/1 will be backed up to /tmp/target with id test

% duplicacy backup
Storage set to /tmp/target
No previous backup found
Indexing /tmp/1
Parsing filter file /tmp/1/.duplicacy/filters
Loaded 0 include/exclude pattern(s)
Packed 2/3/4/5/hello.txt (6)
Backup for /tmp/1 at revision 1 completed

% rm 2/3/4/5/hello.txt

% duplicacy restore -r 1 -- "2/3/4/5/*"
Storage set to /tmp/target
Loaded 1 include/exclude pattern(s)
Indexing /tmp/1
Parsing filter file /tmp/1/.duplicacy/filters
Loaded 0 include/exclude pattern(s)
Restoring /tmp/1 to revision 1
Downloaded 2/3/4/5/hello.txt (6)
Restored /tmp/1 to revision 1
Total running time: 00:00:01

I’m wondering if the issue is with unicode characters?

This is not caused by unicode characters. When I repeated the code above, I could restore the specified folder. After checking, I found that my specified path was wrong. I needed to change the command duplicacy restore -r 1 – ‘图书馆/回收箱/*’ to duplicacy restore -r 1 – “回收箱/*” or duplicacy restore -r 1 – ‘回收箱/*’. The reason is that the upper-level folder “图书馆” is redundant and needs to be removed. Thank you very much! !

1 Like