My proposal is to add a new field to the preference:
... "symlink_follow": ["^dir1/link.*", "^dir2/[^/]+$"] ...
The value is a list of regex patterns. If a symlink matches any regex pattern in the list, then the symlink will be followed. If the target is a file, the target file will be backed up. If the target is a directory, the target directory will be listed.
If a symlink doesn’t match any pattern in the list, the symlink is backed up as a symlink (if it is not excluded by the
Another change to be made is, when a symlink is to be followed and the target turns out to be a directory, the source directory (basically the path of the symlink with a trailing
/ added) is checked against include/exclude patterns in the
filters file to determine if the source directory is excluded. Note that it is the source directory, not the target directory, that will be checked.
symlink_follow is null or an empty list, then a default pattern
^[^/]+$ is used. This pattern means only the symlinks in the root of the repository, not any subdirectories, will be followed, which is the current behavior.
I don’t want to add
symlink_follow as an option to the backup command, because that would be error-prone. For instance, you may only run the backup in a script with a carefully selected
symlink_follow patterns, but one day you accidentally type
duplicacy backup, and your backup will be screwed.
symlink_follow patterns will be stored in the snapshot files so you’ll be able to go back and check what patterns were used in the past.