# Delete files on GoogleDrive with rclone command3

**URL:** <https://forum.rclone.org/t/delete-files-on-googledrive-with-rclone-command3/35779>\
**Category:** Help and Support\
**Created:** [January 28, 2023, 1:27pm UTC](https://forum.rclone.org/t/delete-files-on-googledrive-with-rclone-command3/35779 "2023-01-28T13:27:56Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![lebossejames](https://forum.rclone.org/user_avatar/forum.rclone.org/lebossejames/32/4998_2.png) [@lebossejames](https://forum.rclone.org/u/lebossejames)\
**Post date:** [January 28, 2023, 1:27pm UTC](https://forum.rclone.org/t/delete-files-on-googledrive-with-rclone-command3/35779/1 "2023-01-28T13:27:56Z")

</div>

Hello,

I try with rclone\_v1.61.1 , i cannot delete files on GoogleDrive (upload/download works fine).

I get theses traces:

```auto
rclone -v delete HomeRaspHostFiles:/UsersWantOvpn.txt
2023/01/28 14:24:13 ERROR : UsersWantOvpn.txt: Couldn't delete: googleapi: Error 403: The user does not have sufficient permissions for this file., insufficientFilePermissions
2023/01/28 14:24:13 ERROR : Attempt 1/3 failed with 2 errors and: failed to delete 1 files
2023/01/28 14:24:14 ERROR : UsersWantOvpn.txt: Couldn't delete: googleapi: Error 403: The user does not have sufficient permissions for this file., insufficientFilePermissions
2023/01/28 14:24:14 ERROR : Attempt 2/3 failed with 2 errors and: failed to delete 1 files
2023/01/28 14:24:15 ERROR : UsersWantOvpn.txt: Couldn't delete: googleapi: Error 403: The user does not have sufficient permissions for this file., insufficientFilePermissions
2023/01/28 14:24:15 ERROR : Attempt 3/3 failed with 2 errors and: failed to delete 1 files
2023/01/28 14:24:15 Failed to delete with 2 errors: last error was: failed to delete 1 files

```

I don't find what is the problem, i use a service account.

 ![Sans titre](https://forum.rclone.org/uploads/default/original/2X/7/71b896459556ad25f14ddcccc0c099537a93648e.png)

Thank you

---

<div class="post-metadata">

**Author:** ![asdffdsa](https://forum.rclone.org/letter_avatar_proxy/v4/letter/a/848f3c/32.png) [@asdffdsa](https://forum.rclone.org/u/asdffdsa)\
**Post date:** [January 28, 2023, 2:28pm UTC](https://forum.rclone.org/t/delete-files-on-googledrive-with-rclone-command3/35779/2 "2023-01-28T14:28:13Z")

</div>

hello,

please post the redacted config.

---

<div class="post-metadata">

**Author:** ![lebossejames](https://forum.rclone.org/user_avatar/forum.rclone.org/lebossejames/32/4998_2.png) [@lebossejames](https://forum.rclone.org/u/lebossejames)\
**Post date:** [January 28, 2023, 5:07pm UTC](https://forum.rclone.org/t/delete-files-on-googledrive-with-rclone-command3/35779/3 "2023-01-28T17:07:27Z")

</div>

```auto
[HomeRaspHostFiles]
type = drive
scope = drive
root_folder_id = 14jiS537Kk2ACtcBuhTc0c5xGGUoElXHt
service_account_file = /home/james/Desktop/Scripts/service_account.json

```

---

<div class="post-metadata">

**Author:** ![ncw](https://forum.rclone.org/user_avatar/forum.rclone.org/ncw/32/18_2.png) [@ncw](https://forum.rclone.org/u/ncw)\
**Post date:** [January 28, 2023, 5:14pm UTC](https://forum.rclone.org/t/delete-files-on-googledrive-with-rclone-command3/35779/4 "2023-01-28T17:14:52Z")

</div>

Does your service account user have permission to delete these files?

---

<div class="post-metadata">

**Author:** ![lebossejames](https://forum.rclone.org/user_avatar/forum.rclone.org/lebossejames/32/4998_2.png) [@lebossejames](https://forum.rclone.org/u/lebossejames)\
**Post date:** [January 28, 2023, 5:50pm UTC](https://forum.rclone.org/t/delete-files-on-googledrive-with-rclone-command3/35779/5 "2023-01-28T17:50:34Z")

</div>

I don't know how can you see the permission of service accound on my personnal Drive?

---

<div class="post-metadata">

**Author:** ![ncw](https://forum.rclone.org/user_avatar/forum.rclone.org/ncw/32/18_2.png) [@ncw](https://forum.rclone.org/u/ncw)\
**Post date:** [January 29, 2023, 4:21pm UTC](https://forum.rclone.org/t/delete-files-on-googledrive-with-rclone-command3/35779/6 "2023-01-29T16:21:41Z")

</div>

It won't have any permissions by default unless you share it with the service account.

Service accounts act like separate users.

---

<div class="post-metadata">

**Author:** ![lebossejames](https://forum.rclone.org/user_avatar/forum.rclone.org/lebossejames/32/4998_2.png) [@lebossejames](https://forum.rclone.org/u/lebossejames)\
**Post date:** [January 29, 2023, 5:11pm UTC](https://forum.rclone.org/t/delete-files-on-googledrive-with-rclone-command3/35779/7 "2023-01-29T17:11:45Z")

</div>

What is the solution?

---

<div class="post-metadata">

**Author:** ![ncw](https://forum.rclone.org/user_avatar/forum.rclone.org/ncw/32/18_2.png) [@ncw](https://forum.rclone.org/u/ncw)\
**Post date:** [January 29, 2023, 6:06pm UTC](https://forum.rclone.org/t/delete-files-on-googledrive-with-rclone-command3/35779/8 "2023-01-29T18:06:23Z")

</div>

Give the service account user the correct permissions is the solution.

I'm not sure on the mechanics of this, I know people often share directories with the service account user and then use --drive-shared-with-me to access them with the service account. There may be better solutions though.

Service accounts don't work particularly well with normal google drive accounts - they work best with an enterprise account where you can delegate permissions to them.

---

<div class="post-metadata">

**Author:** ![lebossejames](https://forum.rclone.org/user_avatar/forum.rclone.org/lebossejames/32/4998_2.png) [@lebossejames](https://forum.rclone.org/u/lebossejames)\
**Post date:** [January 29, 2023, 6:36pm UTC](https://forum.rclone.org/t/delete-files-on-googledrive-with-rclone-command3/35779/9 "2023-01-29T18:36:13Z")

</div>

> [@ncw](#):
>
> hare directories with the service account user an

If i choose a plan ?

 ![Capture d’écran du 2023-01-29 19-35-17](https://forum.rclone.org/uploads/default/original/2X/2/20a03c283c21a21f2404a4890031e89632186ecd.png)

---

<div class="post-metadata">

**Author:** ![ncw](https://forum.rclone.org/user_avatar/forum.rclone.org/ncw/32/18_2.png) [@ncw](https://forum.rclone.org/u/ncw)\
**Post date:** [January 29, 2023, 9:58pm UTC](https://forum.rclone.org/t/delete-files-on-googledrive-with-rclone-command3/35779/10 "2023-01-29T21:58:44Z")

</div>

Having a plan doesn't help.

I suggest you don't use service accounts with your personal drive. That will fix it.

---

<div class="post-metadata">

**Author:** ![Marcus1](https://forum.rclone.org/user_avatar/forum.rclone.org/marcus1/32/9187_2.png) [@Marcus1](https://forum.rclone.org/u/Marcus1)\
**Post date:** [January 30, 2023, 2:54pm UTC](https://forum.rclone.org/t/delete-files-on-googledrive-with-rclone-command3/35779/11 "2023-01-30T14:54:59Z")

</div>

How is the upload/download working then? If you didn't grant the SA permissions to that Drive, nothing should work.

---

<div class="post-metadata">

**Author:** ![Animosity022](https://forum.rclone.org/user_avatar/forum.rclone.org/animosity022/32/451_2.png) [@Animosity022](https://forum.rclone.org/u/Animosity022)\
**Post date:** [January 30, 2023, 3:39pm UTC](https://forum.rclone.org/t/delete-files-on-googledrive-with-rclone-command3/35779/12 "2023-01-30T15:39:23Z")

</div>

Create/upload/download is different from deleting.

The permissions are:

> **[Permissions: create  |  Google Drive  |  Google Developers](https://developers.google.com/drive/api/v3/reference/permissions/create)**

---

<div class="post-metadata">

**Author:** ![Marcus1](https://forum.rclone.org/user_avatar/forum.rclone.org/marcus1/32/9187_2.png) [@Marcus1](https://forum.rclone.org/u/Marcus1)\
**Post date:** [January 30, 2023, 3:58pm UTC](https://forum.rclone.org/t/delete-files-on-googledrive-with-rclone-command3/35779/13 "2023-01-30T15:58:36Z")

</div>

Yep, but I was wondering how he could be uploading/downloading files if he didn't grant any kind of access to the SA on the Google Drive:

> [@lebossejames](#):
>
> I don't know how can you see the permission of service accound on my personnal Drive?

---

<div class="post-metadata">

**Author:** ![Animosity022](https://forum.rclone.org/user_avatar/forum.rclone.org/animosity022/32/451_2.png) [@Animosity022](https://forum.rclone.org/u/Animosity022)\
**Post date:** [January 30, 2023, 4:03pm UTC](https://forum.rclone.org/t/delete-files-on-googledrive-with-rclone-command3/35779/14 "2023-01-30T16:03:15Z")

</div>

He did grant access if the OP did nothing, it wouldn't work.

---

<div class="post-metadata">

**Author:** ![lebossejames](https://forum.rclone.org/user_avatar/forum.rclone.org/lebossejames/32/4998_2.png) [@lebossejames](https://forum.rclone.org/u/lebossejames)\
**Post date:** [February 1, 2023, 6:38pm UTC](https://forum.rclone.org/t/delete-files-on-googledrive-with-rclone-command3/35779/15 "2023-02-01T18:38:56Z")

</div>

Have you a solution please?

---

<div class="post-metadata">

**Author:** ![Animosity022](https://forum.rclone.org/user_avatar/forum.rclone.org/animosity022/32/451_2.png) [@Animosity022](https://forum.rclone.org/u/Animosity022)\
**Post date:** [February 1, 2023, 7:16pm UTC](https://forum.rclone.org/t/delete-files-on-googledrive-with-rclone-command3/35779/16 "2023-02-01T19:16:15Z")

</div>

Don't use a service account with a personal drive as noted above.

---

<div class="post-metadata">

**Author:** ![lebossejames](https://forum.rclone.org/user_avatar/forum.rclone.org/lebossejames/32/4998_2.png) [@lebossejames](https://forum.rclone.org/u/lebossejames)\
**Post date:** [February 2, 2023, 9:48am UTC](https://forum.rclone.org/t/delete-files-on-googledrive-with-rclone-command3/35779/17 "2023-02-02T09:48:40Z")

</div>

So how can i get a lifetime api key (deprecated by Google) ?

---

<div class="post-metadata">

**Author:** ![ncw](https://forum.rclone.org/user_avatar/forum.rclone.org/ncw/32/18_2.png) [@ncw](https://forum.rclone.org/u/ncw)\
**Post date:** [February 2, 2023, 10:41am UTC](https://forum.rclone.org/t/delete-files-on-googledrive-with-rclone-command3/35779/18 "2023-02-02T10:41:23Z")

</div>

There is no need, just create a non-SA google drive remote and rclone will refresh the token whenever necessary and save it back to the config file.

---

<div class="post-metadata">

**Author:** ![system](https://forum.rclone.org/uploads/default/original/2X/3/39ad3235f6ffec76ccd0c81616bd55697b4c300d.png) [@system](https://forum.rclone.org/u/system)\
**Post date:** [March 4, 2023, 10:41am UTC](https://forum.rclone.org/t/delete-files-on-googledrive-with-rclone-command3/35779/19 "2023-03-04T10:41:52Z")

</div>

Closed on March 4, 2023, 10:41am UTC

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