Follow symlinks and ignore broken ones

What is the problem you are having with rclone?

I would like to know if there is any way of following symlinks but quietly ignoring broken symlinks. I know --copy-links copies the pointed file, but it gives me an error when a symlink is broken.

Run the command 'rclone version' and share the full output of the command.

rclone v1.65.0

  • os/version: centos 8.4.2105 (64 bit)
  • os/kernel: 4.18.0-305.7.1.el8_4.x86_64 (x86_64)
  • os/type: linux
  • os/arch: amd64
  • go/version: go1.21.4
  • go/linking: static
  • go/tags: none

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)

I'm checking the size for now, but would like to do this with the copy command as well.

rclone size . --copy-links 

Please run 'rclone config redacted' and share the full output. If you get command not found, please make sure to update rclone.

type = drive
client_id = XXX
client_secret = XXX
scope = drive
token = XXX
team_drive = XXX
root_folder_id =

A log from the command that you were trying to run with the -vv flag

2023/12/01 15:44:36 ERROR : /path/to/some/file: Listing error: symlink: stat /path/to/some/file: no such file or directory
2023/12/01 15:44:38 Failed to size with 29 errors: last error was: symlink: stat /path/to/some/file: no such file or directory

Generate a list of broken links and exclude them from your rclone command.

rclone size . --copy-links --exclude-from /path/to/broken_links.txt

One way to generate such list could be to use GNU find program:

find * -xtype l -fprint /path/to/broken_links.txt

That sounds like a good solution, but for some reason it is not working for me. I'm still getting the same error messages.

Because you are doing something wrong. And I have no special powers to see what you are doing so good luck with fixing it yourself.

It works perfectly for me.

Unnecessarily rude, but ok. Is it within your special powers to share your rclone version and what your broken_links file looks like so that I can fix it myself?