Empty .duplicacy directory created in restore target

I am using the CLI to restore, and my restore target folder gets an empty .duplicacy directory, how can I prevent this?

This is my steps:

  - [Download CLI](https://github.com/gilbertchen/duplicacy/releases).
    - `wget -O duplicacy https://github.com/gilbertchen/duplicacy/releases/download/v3.2.3/duplicacy_linux_x64_3.2.3`
    - `chmod +x duplicacy`
    - `mv ./duplicacy /usr/local/bin/`
  - [Init](https://github.com/gilbertchen/duplicacy/wiki/init)
    - `mkdir ./backup`
    - `duplicacy init -encrypt -storage-name B2-Backup -repository ./backup B2-Backup-Backup b2://ptr727-Duplicacy-Server-1-Backup`
  - [Set](https://github.com/gilbertchen/duplicacy/wiki/set) [Passwords](https://github.com/gilbertchen/duplicacy/wiki/Managing-Passwords).
    - `duplicacy set -key b2_id -value [id]`
    - `duplicacy set -key b2_key -value [key]`
    - `duplicacy set -key password -value [password]`
  - [List](https://github.com/gilbertchen/duplicacy/wiki/list):
    - `duplicacy list -all`
    - `duplicacy list -files -r [revision]`
    - `duplicacy cat -r [revision] ["file"]`
  - [Restore](https://github.com/gilbertchen/duplicacy/wiki/restore):
    - `duplicacy restore -r [revision] -delete -overwrite -ignore-owner -stats ["pattern"]`

Any ideas?

-pref-dir <path>                alternate location for the .duplicacy directory (absolute or relative to current directory)

https://github.com/gilbertchen/duplicacy/wiki/init

I wanted my .duplicacy state directory to be in my home directory, so I did not specify -pref-dir, and as expected it is created in home, but during either restore or some other operation it is also created in the -repository directory?

I’m not sure I understand.

Unless you specify pref-dir, the .duplicacy folder is created in current directory. If your current directory is home, then it will be created in home.

My current directory is home, I want .duplicacy to be created in home, so I do not specify pef-dir.
After init my ~/.duplicacy does contain the correct JSON preferences config.
But my -repository directory also contains a .duplicacy directory that is empty,. I do not want a .duplicacy directory to be created in my restore target directory.

I verified that if I delete the empty .duplicacy in target, then restore, the empty .duplicacy directory is again recreated by the restore operation, not expected.

Oh, you use -repository key.

If you don’t specify the -pref-dir, the .duplicacy will be created in the repository root. By default its current directory, but since you are modifying it it with —repository option, then that’s where it is created instead.

If you want preferences directory elsewhere you need to specify it with -pref-dir.

Ok, that does not really make sense since it is finding the preferences, then why would it create an empty directory?
And -pref-dir is not documented as an option for restore, and I tested it -pref-dir is not a valid option for restore?

Interesting. Maybe it a bug. I’ll try to reproduce.

1 Like

I also note this The -pref-dir option is deprecated and the -repository option should be used instead. in the init documentation?