Workspace Drive Files/Folder Owners + Path

149 views
Skip to first unread message

Marcus Jackson

unread,
Oct 21, 2024, 5:54:19 PM10/21/24
to GAM for Google Workspace
Hello, 

We are trying to identify if there is a way to get a readout of every shared file/folder in my domain and owner along with a file path? No admin tools have been able to snapshot this data for us yet.

Thank you, 

Marcus

Ross Scroggs

unread,
Oct 21, 2024, 6:00:49 PM10/21/24
to google-ap...@googlegroups.com
Do you want nternal (within domain) and external (outside domin) shares?
Do you want My Drive shares and Shared Drive shares?

Ross
----
Ross Scroggs



--
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/bb454686-244c-4b39-a389-9ee15907c8a6n%40googlegroups.com.

Marcus Jackson

unread,
Oct 21, 2024, 6:21:31 PM10/21/24
to google-ap...@googlegroups.com
Thanks for reaching back out, 

Both internal and external are needed but only My Drive shares. 

-Marcus


Ross Scroggs

unread,
Oct 21, 2024, 7:10:34 PM10/21/24
to google-ap...@googlegroups.com
gam config auto_batch_min 1 num_threads 15 redirect csv ./SharedFiles.csv multiprocess redirect stderr - multiprocess all users print filelist fields id,name,mimetype,basicpermissions filepath pm not role owner em pmfilter oneitemperrow
#  config auto_batch_min 1 num_threads 15 - Turn on parallel processing
# redirect csv ./SharedFiles.csv multiprocess - Output file
# redirect stderr - multiprocess  - Clean progress messages
# all users  - The whole gang
# print filelist fields id,name,mimetype,basicpermissions filepath - Get data
# pm not role owner em pmfilter oneitemperrow  - Only include files with an ACL other than owner, i.e. shared

For a Google Sheet instead of a local CSV file :
replace: csv ./SharedFiles.csv multiprocess
with: csv - multiprocess todrive

Ross
----
Ross Scroggs


Marcus Jackson

unread,
Oct 21, 2024, 8:38:42 PM10/21/24
to google-ap...@googlegroups.com
This is nothing short of amazing. Worked like a charm! 

Thank you, 

Marcus

Robert Fine

unread,
Oct 22, 2024, 10:09:45 AM10/22/24
to GAM for Google Workspace
Hi Ross, 

Thats works amazing! 

how can we do this for all shared drives within a domain ? 

or do we need to run it per shared drive ? 

Ross Scroggs

unread,
Oct 22, 2024, 10:48:50 AM10/22/24
to google-ap...@googlegroups.com
All files on Shared Drives are shared. What specifically are you after?

Ross
----
Ross Scroggs



Robert Fine

unread,
Oct 22, 2024, 11:06:58 AM10/22/24
to GAM for Google Workspace
Hi Ross, 

Some of my customers use shared drives but employees sometimes share files to gmail, hotmail, live ect.

in this case it would be shared outside of the domain 
i know i can use:  pm not domainlist customer.domain em pmfilter oneitemperrow
to get all that is shared and not customer.domain. 

or:  pm domainlist gmail em pmfilter oneitemperrow

to specifically search for gmail 

but can i get the output of all shared drives at once somehow ? 

Ross Scroggs

unread,
Oct 22, 2024, 11:12:57 AM10/22/24
to google-ap...@googlegroups.com

Make some edits and then save the script
# If you want to limit organizers to a specific list of domains, use the list below, e.g., DOMAIN_LIST = ['domain.com',] DOMAIN_LIST = ['domain1.com', 'domain2.com',\
                                                                                                                                                                   
DOMAIN_LIST = ['domain.com']

INCLUDE_TYPES = {
  'user': True, # False - don't show user organizers, True - show user organizers                                                                                     
  'group': False, # False - don't show group organizers, True - show group organizers                                                                                 
  }

ONE_ORGANIZER = True # False - show all organizers, True - show one organizer                                                                                         
SHOW_NO_ORGANIZER_DRIVES = True # False - don't show drives with no organizers, True - show drives with no organizers                                                 

Run the steps:
gam redirect csv ./TeamDrives.csv print teamdrives fields id,name
gam redirect csv ./TeamDriveACLs.csv multiprocess csv ./TeamDrives.csv gam print drivefileacls "~id" fields id,emailaddress,role,type,deleted
python GetTeamDriveOrganizers.py TeamDriveACLs.csv TeamDrives.csv TeamDriveOrganizers.csv


gam config csv_input_row_filter "organizers:regex:^.+$" redirect csv ./ExternallySharedDriveFiles.csv multiprocess redirect stderr - multiprocess csv ./TeamDriveOrganizers.csv gam user "~organizers" print filelist select teamdriveid "~id" fields teamdriveid,id,name,basicpermissions,mimetype pm not domainlist customer.domain em pmfilter oneitemperrow

Ross
----
Ross Scroggs


Marcus Jackson

unread,
Oct 30, 2024, 2:37:39 PM10/30/24
to GAM for Google Workspace
Hello Ross, 

In addition to the information provided in this script, is there a way to display a column that shows when a file/folder or share link was created and another for when it was last modified or access? 

Thank you, 

Marcus

Ross Scroggs

unread,
Oct 30, 2024, 3:01:26 PM10/30/24
to google-ap...@googlegroups.com
Sdd this to the fields list: ,createdTime,modifiedTime

Ross
----
Ross Scroggs


Reply all
Reply to author
Forward
0 new messages