Get list of files and folders shared with a group

254 views
Skip to first unread message

Gary Loney

unread,
Jun 7, 2024, 9:11:19 AM6/7/24
to GAM for Google Workspace
Anyone know a way I can find the files and folders that are shared with a group?

I am cleaning up groups and found that my district has multiple groups for the staff at each campus. 

I am hoping to find files shared with each of the groups so I can pick one group to keep and make sure all the files are shared with the group we retain.

I know how to do that for a user in advanced gam, but I have not been able to figure out how to get the same information for a group. For example, the advanced gam command below returns this error since the group is not a user:

User: campu...@allenisd.org, Service not applicable/Does not exist

Script I tried:
gam user campu...@allenisd.org print filelist fullquery "sharedWithMe=True" id title owners permissions > userfiles.csv

Thanks,

Gary

Ross Scroggs

unread,
Jun 7, 2024, 9:55:51 AM6/7/24
to google-ap...@googlegroups.com
--
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/0631cfa9-a444-4050-8ee7-51711d1c8f9bn%40googlegroups.com.

Gary Loney

unread,
Jun 7, 2024, 10:01:25 AM6/7/24
to GAM for Google Workspace
This is perfect, thank you!

Kevin Rodgers

unread,
Aug 1, 2024, 10:26:07 AM8/1/24
to GAM for Google Workspace
I'm trying to run this script, but I'm not able to get the filelistperms.csv file. I'm running the following command and it errors out at some point before finishing: `gam config auto_batch_min 1 redirect csv ./filelistperms.csv multiprocess ou_and_children "/staff" print filelist fields id,title,permissions,owners.emailaddress,mimetype pm type group em pmfilter`

Any advice is appreciated.

Ross Scroggs

unread,
Aug 1, 2024, 12:41:21 PM8/1/24
to google-ap...@googlegroups.com
It would be helpful to see the error message,

Ross

--
NOTICE: This e-mail message, including any attachment(s), is for the sole use of the intended recipient 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 e-mail and destroy all copies of the original message.

--
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.


--

Kevin Rodgers

unread,
Aug 1, 2024, 2:23:38 PM8/1/24
to GAM for Google Workspace
Thank you. I'm running it again and waiting it to either finish successfully, or error out again. I'll post the success or error when available.

Kevin Rodgers

unread,
Aug 1, 2024, 8:55:34 PM8/1/24
to GAM for Google Workspace
Here are the errors:

ERROR: [Errno 32] Broken pipe
Got 24000 Drive Files/Folders that matched query ('me' in owners) for redacted@...
ERROR: [Errno 32] Broken pipe
Got 6100 Drive Files/Folders that matched query ('me' in owners) for redacted@...Exception ignored in: <function Pool.__del__ at 0x7f4ce5702a20>
Traceback (most recent call last):
  File "multiprocessing/pool.py", line 271, in __del__
  File "multiprocessing/queues.py", line 399, in put
  File "multiprocessing/connection.py", line 200, in send_bytes
  File "multiprocessing/connection.py", line 427, in _send_bytes
  File "multiprocessing/connection.py", line 384, in _send
OSError: [Errno 9] Bad file descriptor

I'm using the screen command connected to a remote installation of gam and then disconnecting the session. Perhaps that has something to do with the command erroring out.

Kevin Rodgers

unread,
Aug 6, 2024, 10:11:22 AM8/6/24
to GAM for Google Workspace
In the absence of a fix, is there a way break this into smaller tasks, i.e., run the command against 1/3 of the users?

Ross Scroggs

unread,
Aug 6, 2024, 10:26:32 AM8/6/24
to google-ap...@googlegroups.com
Send me a Meet/Zoom invitation and I'll trby to help.

Ross
----
Ross Scroggs


Kevin Rodgers

unread,
Aug 6, 2024, 11:06:40 AM8/6/24
to GAM for Google Workspace
Thanks again for your help, Ross! For future reference, this is the command that worked for me:

gam config auto_batch_min 1 num_threads 20 redirect stdout - multiprocess redirect stderr stdout redirect csv ./filelistperms.csv multiprocess ou_and_children "/staff" print filelist fields id,title,permissions,owners.emailaddress,mimetype pm type group emailaddress reda...@htps.us em pmfilter query "'reda...@htps.us' in readers or 'reda...@htps.us' in writers"

The task I was given was to delete a group address, but find out if any files have been shared to it first.

Reply all
Reply to author
Forward
0 new messages