Can I copy file/folder using their id to my gdrive?

I have a google drive shared folder link and also have shared link of file.
And I have got file id from the link.

Can we copy those folder using the rclone to my drive?
I have tried using --drive-root-folder-id flag but no success.

You can add the folder to your own google drive, then use rclone with —drive-shared-with-me flag to copy to dest.

Still how can do using file id?

I just tried and it works perfectly fine. Can you paste logs using -vv flag.

rclone lsd gdrive: --drive-root-folder-id=XXXXXXXXX -vv

you can also try to do it like this:

[src]
type = drive
scope = drive
token = {..........}
root_folder_id = {enter_shared_folder_id}

[dst]
type = drive
scope = drive
token = {..........}
root_folder_id = {your_own_drive}

Actually I want to impliment rclone in a python based telegram bot and wanted to upload file/folder to gdrive.

And that was not helping.

I understand the problem now. What happening is that when you're using --drive-root-folder-id rclone applying flag on both source and destination; thus the copy fails.

If you're using Python to run Rclone then you can easily create a config file and use it with --config flag.

/usr/bin/rclone --config=/full/path/to/config

I don't know Python but PHP and that's how I use it.

I am running this code for copying file using file id
rclone copy --drive-root-folder-id '1cYzBd82oru2cBaX0vAZ3Ce8ii-y37JxX' gd: ./ -v

But getting error

I am doing this on linux.

Try —config method i posted

RCLONE_CONFIG_NAME_ROOT_FOLDER_ID=sth rclone copy name: ./ works for me. The error you get is probably unrelated to your question.

I intend to copy a folder my friend shared with me by giving me the link, to my own gdrive remote called mydrive
I could see the files and subfolders in it by using
rclone lsf mydrive: --drive-root-folder-id=xxxxxxx

However using
rclone copy mydrive: --drive-root-folder-id=xxxxxxx mydrive:/new/
gives me forbidden error. It's because it applied the root folder flag to both and since I don't have write access to my friend's folder, it says forbidden.

I had to append the root-folder-id = xxxxxxx under [myteamdrive] in rclone.conf and then the command did the job.

rclone copy myteamdrive: mydrive:/new/ --drive-server-side-across-configs

And after the copy I changed rclone.conf back to normal.

Can this be done without having to make a remote for team drive ?

1 Like

hello and welcome to the forum,

please create a new post.
and be sure to supply all the requested information,

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