Identify Files Shared Between Users in the same OU

10 views
Skip to first unread message

Steven Matheny

unread,
Apr 28, 2026, 8:45:38 AM (yesterday) Apr 28
to GAM for Google Workspace
I need to monitor files shared between students. I also sometimes need to remove certain file sharing between students. I typically create a CSV of all students file sharing using something like:

gam config auto_batch_min 1 num_threads 10 csv_output_row_filter "viewedByMeTime:date>-90d" redirect csv ./StudentSharedFiles.csv multiprocess redirect stderr - multiprocess ou_and_children "/all students/Middle School" print filelist fields id,name,basicpermissions,mimetype,lastviewedbyme filepath pm not role owner em pmfilter oneitemperrow

I then review the file and filter out appropriate sharing to teachers or Google Classroom and then I remove inappropriate sharing using something like:

gam redirect stdout ./DeletedStudentSharedFiles.csv csv ./StudentSharedFiles.csv gam user "~Owner" delete drivefileacl "~id" "id:~~permission.id~~"

The review step can be time consuming. Is it possible to run a GAM command to identify only files shared by a user to someone in the same OU as the user?

Thanks for helping me improve my current solution,
Steven Matheny
Technology Director (Volunteer)
Christ Lutheran School
Stevensville, Michigan

Reply all
Reply to author
Forward
0 new messages