Can I skip or suppress errors for dangling shortcuts?

What is the problem you are having with rclone?

I am running rclone jobs to copy data from one remote to another, and I use the return code to determine success or failure. A small number of jobs are "failing" (i.e., the return code is non-zero) due to errors trying to copy dangling shortcuts. I don't expect to be able to copy anything useful when the file the shortcut points to is gone, so this error is a red herring that I want to ignore so those jobs complete successfully.

I see the --drive-skip-shortcuts option, but that presumably skips all shortcuts. I just want to skip or suppress errors for dangling shortcuts.

What is your rclone version (output from rclone version)


Which OS you are using and how many bits (eg Windows 7, 64 bit)

Windows 10, 64 bits

Which cloud storage system are you using? (eg Google Drive)

Google Drive

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone copy Source: Target: --drive-server-side-across-configs

A log from the command with the -vv flag

rclone copy Source: Target: --drive-server-side-across-configs
2021/06/30 08:03:15 ERROR : Shortcut Name: Failed to copy: object not found

rclone lsf Source:
2021/06/30 16:20:03 NOTICE: Dangling shortcut "Shortcut Name" detected


the problem is that relying on the error code alone, is that you have no idea what the error is.
perhaps there is a serious error, perhaps just the shortcut error.

in my case, i have a script that i use to run rclone with a debug log.
after rclone has completed, the script scans the log for errors and other text.
it also can ignore certain text.

hope that sparks some ideas...

I understand what you're saying, but I don't think I should need to grep a log for strings to ascertain the binary success/fail state of a job. That's the role of the status code. I also don't think the status code should be set to a non-zero for a benign condition that has no impact on the true success or failure of the job.

From a binary perspective.

It tried to copy a file.
It failed.
That's not a successful job.

If you have dangling shortcuts, is that something you can clean up prior to the copy? Having a link go to nothing feels like a bad starting state as you'd get that with any copy tool.

felix@gemini:~/test$ cp * ../test1
cp: cannot stat 'blah': No such file or directory
felix@gemini:~/test$ echo $?

with a bad link on a regular copy command in Linux.

I understand what you're saying, but from a real-world perspective, that was a successful job in my world. We can agree to disagree on semantics.

Are you talking about using rclone in some new-to-me mode to identify and prune dangling shortcuts? Even if that's possible, I don't think I'd want that because I'm dealing with thousands of drives of unknown composition, many of which are quite large and heavily nested. Traversing those in a pre-copy pass would take forever.

I'd guess a --drive-skip-dangling-shortcuts option wouldn't work because I don't know if there's a way to identify a dangling shortcut before encountering the problem. But it seems like a flag to not treat that condition as an error would work.

I was just using your binary analogy as it isn't semantics in this case as a copy failed.

The reason is because a shortcut went nowhere. Why it failed would be the challenge as the reason (in your case), is not a valid reason for your use case. I get that and that's not debatable as your use case is 100% valid for you.

I'd assume if rclone can detect a dangling shortcut, it's scriptable and they can be removed.

Sure, but if I'm expecting a backup and I have something missing, I'd want to know that as a broken sym link or in this case a shortcut that goes to nothing.

I'd suggest to just open a feature request and if it gets traction, it can be implemented.

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