"--copy-links / --links" separate flags for junctions vs symlinks


I have a rather complex folder structure for my Windows 10 PC for OneDrive local folder with both symlinks and junctions. I am trying to use rclone to synchronize as the OneDrive app literally cannot keep up.

I use folder junctions to have locations backed up without actually moving them.
I then use symlinks to files to instead link to OneDrive online-only files (by network drive path) so that I can easily open them while online (without downloading them). Those I do not want rclone to backup as they are already online.

Consequently, I would like for rclone to follow my junctions so that it can sync the content
On the other hand, I want it to create ".rclonelink" for my symlinks.

Looking at the documentation the only way I found to do that is to artificially split the commands using "--exclude-if-present" files

rclone sync -v --exclude-if-present SYMLINK.FILES --exclude-if-present ONLINE.ONLY --copy-links "D:\OneDrive" "OneDrive:"

rclone sync -v --exclude-if-present ONLINE.ONLY --links "D:\OneDrive\symlinks\path" "OneDrive:symlinks/path"

I have the "SYMLINK.FILES" file in my folder with all those symlinks I do not want to follow
I have the "ONLINE.ONLY" file in the folder in which the linked files are located on OneDrive that I want to only access via the network drive

This solution sort of works but it requires being careful with those "exclude-if-present" files else everything breaks.

Would it be possible to have separate flags for the --copy-links / --links for junctions and symlinks? e.g. "--copy-symlinks / --symlinks" to define the behaviour exclusively for symlinks and "--copy-junctions / --junctions" to define the behaviour exclusively for junctions.
That way I could have one single command like

rclone sync -v --exclude-if-present ONLINE.ONLY --copy-junctions --symlinks "D:\OneDrive" "OneDrive:"

Alternatively, am I missing something obvious and is there actually an easier solution?

Thank you :slightly_smiling_face:

welcome to the forum,

yeah, that could break.

as a possible workaround, perhaps, use filters.
this is a very, very, simple example,
rclone sync "D:/OneDrive" "OneDrive:" --exclude=/symlinks/path/ --copy-links

for a more complete approach, --filters or --filter-from

That would need to be actually

rclone sync "D:\OneDrive" "OneDrive:" --exclude=/symlinks/path/ --exclude=\symlinks\path\ --exclude=/online/only/path {etc} --copy-links

With that I mean it would need to the repeated for each local path and also be repeated for each remote path (the latter to avoid deletion)

On a similar note does rclone care about / or \ for paths?

the thing is, given there are multiple workarounds, your feature request is most likely not going to be implemented any time soon, if ever.
you can create a github issue and see what happens.

take a few minutes to read the docs.
filters are very powerful, support regex
i think you would want --filters-from

for source and dest, rclone can handle both.
rclone ls c:\path/to\folder

but for filters, only / can be used

thank you for your suggestion. You are essentially saying to try --filters-from myFilters.txt and put a list of filters either as full paths or regex in that txt file. I will try that. That said I feel like this approach is prone to break too just as much as the --exclude-if-present files

I will try to raise a github issue :+1:

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.