Skip to content

drive: can't delete shared files #3998

Open

Description

@lebossejames

What is the problem you are having with rclone?

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.

What is your rclone version (output from rclone version)

rclone v1.47.0

  • os/arch: linux/amd64
  • go version: go1.12.4

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Ubuntu 19.04 version 64bits

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 -v delete GD:myfolder/myfile.json

A log from the command with the -vv flag (eg output from rclone -vv copy /tmp remote:tmp)

See : https://forum.rclone.org/t/delete-files-on-googledrive-with-rclone-command/14445?u=lebossejames

Activity

  1. added this to the Known Problem milestone on Feb 24, 2020
  2. changed the title [-]delete-files-on-googledrive-with-rclone-command not works[/-] [+]drive: can't delete shared files[/+] on Feb 24, 2020
  3. ncw commented on Feb 24, 2020

    @ncw
    Member

    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

    Possible fixes

    1. rclone reads the canDelete flag in the capabilities and if that is not set then use the removeParents work-around. The canDelete flag needs to be added to the object I think so read in the listings etc,

    2. we attempt to delete it the normal way and if that fails with a 403 error attempt to delete it with the removeParents way.

    Option 2 is probably easiest to code however it will be a little less efficient if we are deleting lots of shared files.

    Open Question: can we use the removeParents workaround all the time - what happens if we orphan a file?

    Anyone like to work on this?

  4. ivandeex commented on Feb 9, 2021

    @ivandeex
    Member

    @lebossejames
    This bug is reported against an obsolete version of rclone. Can you reproduce it with rclone 1.54?

  5. ezlo-eugenek commented on Mar 3, 2021

    @ezlo-eugenek

    I can confirm that it is still so in 1.54.
    rclone version
    rclone v1.54.0

    • os/arch: linux/amd64
    • go version: go1.15.7
      rclone delete drive-:/test-shared/test.docx --drive-shared-with-me
      2021/03/03 09:38:57 ERROR : test.docx: Couldn't delete: googleapi: Error 403: The user does not have sufficient permissions for this file., insufficientFilePermissions
      2021/03/03 09:38:57 ERROR : Attempt 1/3 failed with 2 errors and: failed to delete 1 files
  6. jonathantyar commented on Dec 16, 2021

    @jonathantyar

    any PR or update regarding this issue?

  7. zezettepglc commented on Aug 7, 2023

    @zezettepglc

    This bug is still in 1.63.1 ...

    With Grive, deleting files created by other Google account in a shared folder is not a problem

  8. ncw commented on Aug 9, 2023

    @ncw
    Member

    I don't think this would be very difficult to fix - I outlined a plan above.

    If you are working on behalf of a company you might be interested in taking out a support contract which can help you get answers quicker and keeps the rclone project sustainable. I could do this as part of a support contract.

  9. adityabagla7 commented on Sep 4, 2026

    @adityabagla7
    Contributor

    I'll take this. Plan: on delete/trash 403 insufficientFilePermissions, fall back to unlinking via removeParents (maintainer option 2 in the thread), with tests and a short docs note.

  10. added a commit that references this issue on Sep 7, 2026
    a2f5c8d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions