Duplicacy CLI - Unable to initialize multiple repositories -> storage connections


#1

I want to backup two directories (“two repositories”?), so I try:

duplicacy init -storage-name storage1 duplicacy-test1 R:/backup/duplicacy
which works, then I try:
duplicacy init -storage-name storage1 duplicacy-test2 R:/backup/duplicacy
Fails with:
ERROR REPOSITORY_INIT The repository C:\bin\duplicacy has already been initialized
This makes sense, I haven’t given a parameter for my backup location.
I find intuitive option for init -repository. I try:
duplicacy init -repository test2 -storage-name storage1 duplicacy-test2 R:/backup/duplicacy
and I get:
The repository C:\bin\duplicacy has already been initialized
So now I see the .duplicacy directory being created in “current working directory” despite the help duplicacy init --help lying to me that the repository will be initialized at <path>.
Deleting that lets me run a new init, which simply recreates .duplicacy on additional attempts at init, no matter what I specify for -repository.
Then I find the -pref-dir. Ohhhh, this must be the other, other initialization. Cool:

duplicacy init -pref-dir pref -repository tmp -storage-name storage-test2-name duplicacy-cli2 R:/external/duplicacy-cli2
The repository C:\bin\duplicacy has already been initialized
duplicacy init -pref-dir pref -repository tmp -storage-name storage-test2-name duplicacy-cli2 R:/external/duplicacy-cli2
The repository C:\bin\duplicacy has already been initialized
duplicacy init -pref-dir pref -repository tmp -storage-name storage-test2-name duplicacy-cli2 R:/external/duplicacy-cli2
The repository C:\bin\duplicacy has already been initialized
duplicacy init -pref-dir pref -repository tmp -storage-name storage-test2-name duplicacy-cli2 R:/external/duplicacy-cli2
The repository C:\bin\duplicacy has already been initialized
duplicacy init -pref-dir pref -repository tmp -storage-name storage-test2-name duplicacy-cli2 R:/external/duplicacy-cli2
The repository C:\bin\duplicacy has already been initialized
duplicacy init -pref-dir pref -repository tmp -storage-name storage-test2-name duplicacy-cli2 R:/external/duplicacy-cli2
The repository C:\bin\duplicacy has already been initialized

Oh, now there’s just a file named .duplicacy in the “current working directory”. Nice.

I give up. Took me like, 4, 5 commands tops, with Borg…

Yikes.


#2

Hello Ronin, welcome to the forum.

Let’s do it by steps.

Yes, “directories to be backed up” = "repositories”.

First question: two repositories to the same storage or each one to a different storage?

As you noted, you can run the init command with or without the -pref-dir parameter.

If you run without this parameter, the .duplicacy folder will be created in the folder where you are running the command, and this folder will contain the Duplicacy setup files.

If you run with this command, a .duplicacy file will be created in the folder where you are running the command, which will point to the folder .duplicacy where the Duplicacy files will be created.

So, second question: Do you want the Duplicacy setup files to remain in each repository, or do you want it to be in a separate location?


#3

Some more clarification, in addition to the previous comment here.

One of the modes Duplicacy works is walking down the hierarchy starting from the root of repository and picking up files according include/exclude filters.

So if you want to backup two folders that are both somewhere in the filesystem under the repository root you could just initialize duplicacy in the root and configure filters to include those two folders only and exclude everything else.

If however you have two unrelated folders to backup, not in the same folder hierarchy - then you have choice. You can create separate duplicacy repository in each of the folders, the cd to first, duplicacy backup, then cd to the second, and duplicacy backup there as well. You will essentially have two unrelated repositories.

Alternatively, you can create a third folder somewhere, put symlinks to the folders you want to backup in it and init single duplicacy repository there. Duplicacy follows first level symlinks (only) by design to support this use case. That way you have a single repository which could be easier to manage.

Hope this helps.