Download a shared google drive file from its URL (or URI)

What is the problem you are having with rclone?

Need to download a file shared to my google drive account using the file url instead of the filename

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

rclone v1.63.1

  • os/version: ubuntu 22.04 (64 bit)
  • os/kernel: 6.2.0-26-generic (x86_64)
  • os/type: linux
  • os/arch: amd64
  • go/version: go1.20.6
  • 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)

rclone copy <remote-name>:URI <destination>  --drive-shared-with-me

where URI used is taken part of Copy link of file as

The rclone config contents with secrets removed.

type = drive
client_id = <client-id>
client_secret = <secret>
scope = drive
token = {"access_token":<access-token>,"token_type":"Bearer","refresh_token":"<refresh-token>","expiry":<expiry-datetime>}
team_drive = 

A log from the command with the -vv flag

Transferred:   	          0 B / 0 B, -, 0 B/s, ETA -
Errors:                 1 (retrying may help)
Elapsed time:         2.4s

2023/08/13 16:38:34 DEBUG : 6 go routines active
2023/08/13 16:38:34 Failed to copy: directory not found

To download file from URL use:

rclone copyurl https://path/to/file .

and have a look at drive-shared-with-me flag. It might be better option.

No that doesnt work. When I try

rclone copyurl <https://link-path> test_file2.mkv --config <path/to/conf> --drive-shared-with-me -vv

just copies a file . that is not the file of interest. Here is the output from debugger

2023/08/13 17:51:24 DEBUG : rclone: Version "v1.63.1" starting with parameters ["rclone" "copyurl" "-vv" "<URI-CHANGED>" "test_file2.mkv" "--config" "/home/user1/.config/rclone/rclone_test.conf" "-vv"]
2023/08/13 17:51:24 DEBUG : Creating backend with remote "."
2023/08/13 17:51:24 DEBUG : Using config file from "/home/user1/.config/rclone/rclone_test.conf"
2023/08/13 17:51:24 DEBUG : fs cache: renaming cache item "." to be canonical "/home/user1/Projects/test"
2023/08/13 17:51:26 DEBUG : test_file2.mkv: md5 = <md5-value> OK
2023/08/13 17:51:26 DEBUG : test_file2.mkv: Size and md5 of src and dst objects identical
2023/08/13 17:51:26 INFO  : 
Transferred:   	  609.166 KiB / 609.166 KiB, 100%, 0 B/s, ETA -
Transferred:            1 / 1, 100%
Elapsed time:         2.2s
2023/08/13 17:51:26 DEBUG : 7 go routines active

Also if I look at copyurl it says how to download a public url to a remote. In this case the url access is restricted and only available to a specific remote.

so only option you have is to use drive-shared-with-me flag

rclone ls my-gdrive: --drive-shared-with-me

should show all files shared with you

and then

rclone copy my-gdrive:file --drive-shared-with-me

I think you can do this with the rclone backend copyid command.

The URL contains the ID of the file which you can use in that command.


Hi Nick,

Yes I can confirm this works very well for files available in the gdrive remote and for files shared to the gdrive remote. Thank you. Might be helpful to add this information somewhere prominently in the website. This is superhelpful especially for google drive remotes.

It probably needs a section in the Google drive docs spelling out how to use rclone backend copyid on a URL.

1 Like

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