Duplicacy CLI won't create mutiple repository/storage in /home directories

I like to keep things organized so I don’t want a .duplicacy folder inside of every directory I want to backup.

For example, say I want to backup the following directories:

/home/upsman/Pictures
/home/upsman/Documents

From my /home directory I can run the following:

duplicacy -d init -e -storage-name nacho -repository /home/upsman/Pictures photobackup sftp://upsman@nacho.local/photobackup

That works great and creates a .duplicacy/preferences file under my root /home

But now if I try the following it fails:

duplicacy -d init -e -storage-name nacho2 -repository /home/upsman/Documents documentbackup sftp://upsman@nacho.local/documentbackup

Duplicacy won’t let you because .duplicacy already exists.

So the hack I have to do, is change to the Documents folder first and then run the duplicacy init command from there. It works but it creates a .duplicacy folder in my Documents folder.

So the hack is to copy the contents of /home/upsman/Documents/.duplicacy to my original /home/upsman/.duplicacy/preferences file and then delete the /home/upsman/Documents/.duplicacy folder.

Why is this. On the GUI version, multiple storages/repositories are stored under ONE file. Why do you have to hack the CLI version

Instead of using init for the second repo, you should use add:

Edit: Actually, I’m not entirely sure a single preferences file can contain the configuration for two seperate repos - despite the add command also supporting the -repository flag. Check the contents of the preferences file and see if it does. Otherwise, you may have to use multiple .duplicacy directories (just like the GUI does).

Yes a single preference file CAN contain multiple configurations for multiple repos, if you manually copy any additional ones.

That is my concern. You have to hack it to get it to work. You shouldn’t have to do it manually.

From my root home directory I created the initial repo. For the 2nd one, I had to first change to the directory I wanted to backup and run the init command from there. That created this second .duplicacy/preferenes file. I copied the contents of it to my initial~/.duplicacy/preferences file. And then I deleted this second preferences file.

So this is what my single preferences file looks like:

[
{
“name”: “nacho”,
“id”: “photobackup”,
“repository”: “/home/user/Pictures”,
“storage”: “sftp://user@nacho.local/photobackup”,
“encrypted”: true,
“no_backup”: false,
“no_restore”: false,
“no_save_password”: false,
“nobackup_file”: “”,
“keys”: {
“password”: “mystoragepassword”,
“ssh_key_file”: “/home/user/.ssh/id_rsa”
},
“filters”: “”,
“exclude_by_attribute”: false
},

{
    "name": "nacho2",
    "id": "documentbackup",
    "repository": "/home/user/Documents",
    "storage": "sftp://user@nacho.local/documentbackup",
    "encrypted": true,
    "no_backup": false,
    "no_restore": false,
    "no_save_password": false,
    "nobackup_file": "",
    "keys": {
        "password": "mystoragepassword!",
        "ssh_key_file": "/home/user/.ssh/id_rsa"
    },
    "filters": "",
    "exclude_by_attribute": false
}

]

Then from anywhere on my system I can back up to both locations by just running the duplicacy backup command.

This prevents me from having to be in the directory itself to run the backup.

So again, I can now run the following from ANY directory, not just within each backup directory

duplicacy backup -storage nacho

or
duplicacy backup -storage nacho2

Did you try the add command?

OK,

Doing it this way works:

duplicacy add -repository /home/user/asciidoc nacho3 asciibackup sftp://user@nacho/asciibackup

So now I can run the following from anywhere on my system:

duplicacy backup -storage nacho
duplicacy backup -storage nacho2
duplicacy backup -storage nacho3