Remove/delete files owned by external Google Accounts

800 views
Skip to first unread message

Thomas Prescott

unread,
Apr 13, 2022, 4:15:20 PM4/13/22
to GAM for Google Workspace
I'm trying to migrate 100k+ files and folders from "My Drive" to a Shared Drive. I'm running in to an issue where I'm not able to move files owned by external accounts (this is expected behavior). What I'd like to do is remove my access from the roughly 45K files that are owned externally.

I have all of the file IDs in CSV format, but get the error below when trying to delete permission IDs via GAM (presumably because the file ID is owned externally).

User: da...@mydomain.com, Drive File/Folder ID: 1agQdOqFbAtT-XXXXXXXXXX, Permission ID: 048536-XXXXXXXXXX, Does not exist

Any ideas on how to mass-remove myself from all files shared to me?

Any/all help is appreciated.

Tom

Ross Scroggs

unread,
Apr 13, 2022, 4:25:44 PM4/13/22
to google-ap...@googlegroups.com
Tom,

Contact me directly via Meet/Zoom.

--
You received this message because you are subscribed to the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/1ae53241-78ab-40a3-94b0-d93161e4584fn%40googlegroups.com.

Ross Scroggs

unread,
Apr 13, 2022, 4:35:42 PM4/13/22
to google-ap...@googlegroups.com
Tom,

Show the command you're issuing.

On Apr 13, 2022, at 1:15 PM, Thomas Prescott <thomas....@project.com> wrote:

Thomas Prescott

unread,
Apr 13, 2022, 4:39:55 PM4/13/22
to google-ap...@googlegroups.com
Ross - 

I can't do a Google Meet tonight, but can chat tomorrow if that works. The command I'm running is below:

gam user da...@domain.com delete drivefileacl ~fileID ~permissionID

da...@domain.com is not the owner of these files - they are all owned externally (e.g. @gmail.com)

Tom Prescott
System Administrator

 

Project Worldwide is an independent, global agency network in service of creativity. 


3600 Giddings Rd
Auburn Hills, MI 48326
 
website: Project.com
 
This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and delete all copies of the message and any attachments. 


You received this message because you are subscribed to a topic in the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-manager/DQPEqbs1_PM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apps-man...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/0036958E-6897-44BE-83CA-6FFE20D5D787%40gmail.com.

Ross Scroggs

unread,
Apr 13, 2022, 4:45:16 PM4/13/22
to google-ap...@googlegroups.com
Tom,

If the permissionId column does not have id: at the beginning, add it in the command.
Try: gam user da...@domain.com delete drivefileacl ~fileID "id:~~permissionID~~"

What kind of access do you have to the files? If you're a writer, you can delete ACLs; if you're a reader you can't.

Ross

Thomas Prescott

unread,
Apr 14, 2022, 6:58:27 AM4/14/22
to google-ap...@googlegroups.com
That worked, Ross! Thanks!

Adding id: before permissionID solved the issue. Thanks much.


Tom Prescott
System Administrator

 

Project Worldwide is an independent, global agency network in service of creativity. 


3600 Giddings Rd
Auburn Hills, MI 48326
 
website: Project.com
 
This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and delete all copies of the message and any attachments. 

Juarez Weiss

unread,
Jan 24, 2023, 2:16:17 PM1/24/23
to GAM for Google Workspace
Hi Tom and Ross,

I'd like to revive this thread. I'm trying to achieve the exact result as Tom's first message.

I've managed to run the proper command and successfully delete the ACLs containing myself from the external files. To confirm, I went to Google Drive via UI and checked that no external files exist in the folder.
But when I try to move the folder to a Shared Drive, I get an error "x items can't be moved" and the move fails. The number of "items that can't be moved" is the exact same number of external items that existed prior to me deleting the ACLs, which makes me think that although the ACLs have been delete, the files still somehow exist in the folder.
Also, if I run the command to find external files in the folder again, the csv now returns empty: gam config csv_output_row_filter "owners.0.emailAddress:notregex:@domain.com$" redirect csv ./filelist.csv user myu...@domain.com print filelist select FOLDERID showownedby others fields id,title,permissions,owners.emailaddress

Any pointers here? I'm going crazy trying to understand this lol
Thanks!

Juarez Weiss

unread,
Jan 25, 2023, 9:56:38 AM1/25/23
to GAM for Google Workspace
Update: I found the "deleted" files in the folder. Although there's no existing permission for my us...@domain.com in the file anymore, if I click "Share" there's a popup saying "Send the link for "file-name"", and it shows that the file has "anyone with the link" as viewer.

Somehow deleting my own ACLs via GAM didn't remove the files from the folder. And the option to "remove" is grayed out, so now the file is dead in my folder with no way to remove it. Seems like a bug?

JoelC

unread,
Jul 17, 2023, 10:34:24 AM7/17/23
to GAM for Google Workspace
Following, I just ran into the exact same scenario.

Thanks!

Ross Scroggs

unread,
Jul 17, 2023, 10:51:59 AM7/17/23
to google-ap...@googlegroups.com
Joel,

Send me a Meet/Zoom invitation if you need help.

Ross



--

Rachel Hassett

unread,
Aug 24, 2023, 1:31:52 AM8/24/23
to GAM for Google Workspace
Ross, was it determined that there is actually a way to programmatically Remove an externally owned file from someone's MyDrive? I'm hearing from these comments that the command to remove permissions doesn't actually remove the file from the folder... 
If you know of any way to "Remove" an externally owned file from someone's MyDrive, I (and my users) would be very very very appreciative.

Thanks, Rachel

Ross Scroggs

unread,
Aug 24, 2023, 9:30:28 AM8/24/23
to google-ap...@googlegroups.com
There is still no way that I know of.

Ross
----
Ross Scroggs



Gezira United

unread,
Aug 24, 2023, 9:48:49 AM8/24/23
to google-ap...@googlegroups.com
Hi rosa
my message deleted automatically when i try to post to google group
do you have any solve iam owner of the group
thanks mohamed

Tom Robinson

unread,
Oct 19, 2023, 6:38:50 PM10/19/23
to GAM for Google Workspace
Is this command Advanced GAM or just GAM? 

In our case the file that is owned externally is in one users mydrive but shared with a bunch of others in our domain. 
Would we need to remove the permission ID for just that one user or for all the users in our org that have access to migrate the files within that one user's MyDrive to a Shared Folder?

How would you update this to loop through a list of FileIDs and Users to remove the permission from each user for each file? 

Ross Scroggs

unread,
Oct 19, 2023, 6:40:56 PM10/19/23
to google-ap...@googlegroups.com
Tom,

Send me a Meet/Zoom invitation to discuss.

Ross
----
Ross Scroggs


Tom Robinson

unread,
Oct 19, 2023, 7:13:15 PM10/19/23
to GAM for Google Workspace
Hi Ross! Thank you. 
I just sent you a Zoom invite if you are free to meet?

To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages