Create shortcut files for drive folder shortcuts

The end of the rclone documentation for drive shortcuts states that, “If you have shortcuts that lead to an infinite recursion in your drive (e.g. a shortcut pointing to a parent folder), skip_shortcuts might be mandatory to be able to copy the drive.”

I have a folder structure with shortcut-induced loops and would like to be able to use rclone on it, and I would like to generate shortcut files for all of the folders in the same way as is currently done for files (when –drive-copy-shortcut-files is not used). It seems like a reasonable thing to want, and my particular use case is so that the shortcut files can serve as annotation reminders as a substitute for an true symlink/shortcut.

Looking closer at the documentation, it seems that the reason that shortcuts to files and folders are handled differently is purely historical, having to do with the 2020 messiness around Google migrating multi-named folders to single-named folders with folder shortcuts (which did not even exist before 2020).

Would it be reasonable to introduce a flag like –drive-copy-folder-shortcut to add the support I’m looking for?

I browsed the drive code and I didn’t see an obvious reason it wouldn’t work. It seems like there are already some tricks in there involving a synthetic mime type, etc., that might be helpful for this issue.

If the only blocker here is just finding a volunteer to do the implementation, I might be willing to give it a shot, depending on the work required. Since I am not at all familiar with this code, anything you can tell me to help me make that determination would be appreciated.

1 Like

Your idea makes sense and would be useful for handling folder shortcuts or creating annotation-style placeholders. The current difference between file and folder shortcuts is mostly historical, so adding a flag like --drive-copy-folder-shortcut seems reasonable. You could base it on the existing --drive-copy-shortcut-files logic, making sure to handle the Google Drive shortcut MIME type and avoid creating recursive loops.