diff --git a/backend/drive/drive.go b/backend/drive/drive.go index 5aa1c02bb..18e29d251 100644 --- a/backend/drive/drive.go +++ b/backend/drive/drive.go @@ -553,6 +553,14 @@ Google don't document so it may break in the future. Normally rclone dereferences shortcut files making them appear as if they are the original file (see [the shortcuts section](#shortcuts)). If this flag is set then rclone will ignore shortcut files completely. +`, + Advanced: true, + Default: false, + }, { + Name: "skip_dangling_shortcuts", + Help: `If set skip dangling shortcut files. + +If this is set then rclone will not show any dangling shortcuts in listings. `, Advanced: true, Default: false, @@ -616,6 +624,7 @@ type Options struct { StopOnUploadLimit bool `config:"stop_on_upload_limit"` StopOnDownloadLimit bool `config:"stop_on_download_limit"` SkipShortcuts bool `config:"skip_shortcuts"` + SkipDanglingShortcuts bool `config:"skip_dangling_shortcuts"` Enc encoder.MultiEncoder `config:"encoding"` } @@ -918,6 +927,11 @@ OUTER: if err != nil { return false, fmt.Errorf("list: %w", err) } + // leave the dangling shortcut out of the listings + // we've already logged about the dangling shortcut in resolveShortcut + if f.opt.SkipDanglingShortcuts && item.MimeType == shortcutMimeTypeDangling { + continue + } } // Check the case of items is correct since // the `=` operator is case insensitive.