Delete files on GoogleDrive with rclone command

I have rclone_v1.47_x64 run on Ubuntu, i cannot delete files on GoogleDrive.

I use this command:

rclone -v delete GD:myfolder/myfile.json

i get theses messages:

2020/02/19 17:58:04 INFO : Waiting for deletions to finish
2020/02/19 17:58:05 ERROR : myfile.json: Couldn't delete: googleapi: Error 403: The user does not have sufficient permissions for this file., insufficientFilePermissions
2020/02/19 17:58:05 ERROR : Attempt 1/3 failed with 2 errors and: failed to delete 1 files
2020/02/19 17:58:05 INFO : Waiting for deletions to finish
2020/02/19 17:58:06 ERROR : myfile.json: Couldn't delete: googleapi: Error 403: The user does not have sufficient permissions for this file., insufficientFilePermissions
2020/02/19 17:58:06 ERROR : Attempt 2/3 failed with 2 errors and: failed to delete 1 files
2020/02/19 17:58:06 INFO : Waiting for deletions to finish
2020/02/19 17:58:07 ERROR : myfile.json: Couldn't delete: googleapi: Error 403: The user does not have sufficient permissions for this file., insufficientFilePermissions
2020/02/19 17:58:07 ERROR : Attempt 3/3 failed with 2 errors and: failed to delete 1 files
2020/02/19 17:58:07 Failed to delete: failed to delete 1 files

Please, help me?

Thank you.

1 Like

you are using a very old version of rclone.
perhaps update and test again.

I try the version 1.51, same problem.

good. now that is done, i am sure someone who uses gdrive can help.

it would seem that you need to tweak security permissions for google drive.

Are these shared files? For some reason you can't delete them through the API I seem to remember.

Otherwise @thestigma might be able to help you diagnose Google drive stuff!

If this is on a teamdrive/shared drive - what permission-level does your user have?

In some cases it can manager-level to delete files uploaded from other users even though "content manager" should technically have full write permissions. I am not sure exactly why or if this is a simple bug on Google's side, but this is the first thing I would try because I have had similar issues myself.

For me it seemed to happen especially during server-side moves where the moving account on the other side was only content manager and not the same user that uploaded file.

Hope this info helps? If not then clarify if I have misunderstood anything.
(I suspect a similar phenomenon could exist on normal (non-teamdrives) for shared folders.

permission level is it available with my account gmail on Google Console ?

No. Permission level is only used for teamdrive/shared drives.
To see permission level for a user on this type of drive - go to Google Drive webpage and look at the users list.

If it is a personal drive type then permissions are not set the same way. you can use "share" function to share with other users but I am not entirely certain what permission level this implies. Probably "content manager". I am not sure as I don't use personal type drives much.

It's my personnal drive. TeamDrive is included with GSuite, for enterprise and to bill each month theses services.

ok.

is GD: a remote that points to a shared folder then?
Or is it just a normal folder on your personal Gdrive?

If it just a normal folder then it is possible you have not configured rclone with the right permission level for GD:

in the rclone.conf file for GD: , what does this line say for you?
scope = ????

Having the exact same issue OP is having. I can't delete files Shared Drive, even though I am Content Manager.

Update: You need to be Manager, (not Content Manager)

Yes it's a normal shared folder on my personal Gdrive.

"scope"= "drive"

I remembered the problem with shared files/folders.

Currently rclone tries to delete them if you ask for them to be deleted - seems reasonable... However this causes Drive to try to delete the original which you don't have permission for. See the docs here: https://developers.google.com/drive/api/v3/reference/files/delete

What rclone should be doing is unlinking the file from the directory I think, so PATCHing the parents of the file/folder so that the current directory is not in them, so using the removeParents parameter here: https://developers.google.com/drive/api/v3/reference/files/update

Maybe someone could have a go with the API explorer in the last link to see whether that works?

1 Like

Yes exactly. I can confirm this is what I've seen.

1 Like

Aha! That explains the technical part of the strange behavior and it makes a lot of sense with what I have seen.

@lebossejames would you please make a new issue on github about this so we don't forget about it. Can you link to this forum post please?

Thanks

1 Like

Yes i create now this issue.

1 Like

What is the difference between Content Manager and Manager? Are there differents configuration of Drive? Is it integrated without GSuite (Professional account if i understand)?

Manager can remove user, delete drive while Content Manager can't. Content Manager only can manage content, thus the naming; while Manager has the privilege to do everything.

Nope.

Don't understand, what you meant.

How can you manage between Content Manager and Manager via GDrive?

https://support.google.com/a/answer/7337554?hl=en

For privileges, you need a account GSuite ?