"rclone link" command for mounted files (local paths conversion)

What is the problem you are having with rclone?

running rclone link ./file on a mounted file results in:

Failed to link: Local file system at /home/user/google-drive-rclone/file doesn't support public links

running rclone link gdrive:file yields correct result (a public url to the file):


However, it would be really convenient if rclone could recognize local file paths. For example, shell autocompletion works much faster when navigating mounted folders (cached) than when running rclone <command> gdrive:/<TAB>.

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

rclone v1.62.2
- os/version: arch "rolling" (64 bit)
- os/kernel: 6.2.8-arch1-1 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.20.2
- go/linking: dynamic
- go/tags: none

I use Arch btw...

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 link

The rclone config contents with secrets removed.

type = drive
client_id = <client_id>
client_secret = <client_secret>
scope = drive
token = <token>
root_folder_id = <root_folder_id>
team_drive = 

A log from the command with the -vv flag

<7>DEBUG : rclone: Version "v1.62.2" starting with parameters ["rclone" "link" "google-drive-rclone/file" "-vv"]
<7>DEBUG : rclone: systemd logging support activated
<7>DEBUG : Creating backend with remote "google-drive-rclone/file"
<7>DEBUG : Using config file from "/home/user/.config/rclone/rclone.conf"
<7>DEBUG : fs cache: renaming cache item "google-drive-rclone/file" to
be canonical "/home/user/google-drive-rclone/file"
<7>DEBUG : 2 go routines active
Failed to link: Local file system at /home/user/google-drive-rclone/file doesn't support public links

You can't link on a mount so that's expected.

Thanks, sorry I didn't mean to say that it's not correct, but I just think that it would be really helpful if rclone could recognize that a given file is in a directory mounted by rclone and so could be used to generate link URL.

I'm looking right now into some way to automate this translation via zsh completions, but do you think that this could be a feature that rclone could add at some point in the future?

Apologies if this should have been a feature request rather than "help and Support" question, but if there is a better way to generate links within an rclone mount that I might have missed please let me know.

There a number of requests for that already on GItHub as it's not easy to implement I'd imagine as it's been out there for some time.

Oh I see, that makes sense. Thanks, so I will keep looking for another solution then...

If anyone had any recommendations what's the best way to do it I'd be greteful. I usually cd into a given directory on an rclone mount, inspect it with various tools and then decide whether to create an rclone link ./file. However, at the moment it seems like you need to get the entire absolute path of the current directory, which may be quite long, remove prefix folders, add rclone prefix (e.g. google-drive:) and then run rclone linke which is quite a lot of steps. I'm wondering if there are any simpler ways or faster ways to format it.

I've been using bash all this time, but this may be just the universe's way to signal switching to zsh, as I've heard it's much better at shell completions. I imagine it would work so that rclone link ./file would "complete"/"translate" to rclone link google-drive:/root/folder/folder/file when pressing <TAB>.

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