Using GAM to export a list of all top level folders within a folder

435 views
Skip to first unread message

Carleigh Duncan

unread,
Aug 26, 2024, 2:07:14 PM8/26/24
to GAM for Google Workspace
Hello! 

I am trying to export a list of all top-level folders within a folder that is not owned by me (but I have access to it). I have found how to export all the top level folders within my own GDrive (gam user <User Email Address> print filelist query "'root' in parents and mimeType='application/vnd.google-apps.folder' and trashed=false" todrive) and someone else's GDrive (using showownedby others todrive), but not how to do the above in a particular folder. 

Any advice is greatly appreciated!

Thank you in advance!

Ross Scroggs

unread,
Aug 26, 2024, 2:31:21 PM8/26/24
to google-ap...@googlegroups.com
Carleigh,

gam user us...@domain.com print filelist select <FolderID> fields id,name,mimetype depth 0 showmimetype gfolder mimetypeinquery showownedby any


Ross


--
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/01a93946-73cc-4b13-b4e8-102cbf1e078fn%40googlegroups.com.


--

Carleigh Duncan

unread,
Aug 26, 2024, 3:32:47 PM8/26/24
to GAM for Google Workspace
Thank you so much! You are amazing!

Carleigh Duncan

unread,
Jan 8, 2025, 1:13:58 PM1/8/25
to GAM for Google Workspace
Hello again Ross!

This command no longer works for me. When I attempt to run it, it throws the following error.

$ gam user <email> print filelist select <Folder ID here> fields id,name,mimetype depth 0 showmimetype gfolder mimetypeinquery showownedby any

Command: /home/cduncan/.gamadv-xtd3/gam >>>user <email> print<<< filelist select <Folder ID> fields "id,name,mimetype" depth 0 showmimetype gfolder mimetypeinquery showownedby any

ERROR: Invalid choice (user 
<email> print): Expected <all|cigroup|cigroup_users|cigroups|courseparticipants|cros|cros_ou|cros_ou_and_children|cros_ou_and_children_queries|cros_ou_and_children_query|cros_ou_queries|cros_ou_query|cros_ous|cros_ous_and_children|cros_ous_and_children_queries|cros_ous_and_children_query|cros_ous_queries|cros_ous_query|cros_sn|croscsv|croscsv_sn|croscsvdata|croscsvfile|croscsvfile_sn|crosfile|crosfile_sn|crosqueries|crosquery|csv|csvdata|csvdatafile|csvfile|csvkmd|csvsubkey|datafile|domains|domains_ns|domains_susp|file|group|group_inde|group_ns|group_susp|group_users|group_users_ns|group_users_select|group_users_susp|groups|groups_inde|groups_ns|groups_susp|licenses|oauthuser|ou|ou_and_children|ou_and_children_ns|ou_and_children_susp|ou_ns|ou_susp|ous|ous_and_children|ous_and_children_ns|ous_and_children_susp|ous_ns|ous_susp|queries|query|students|teachers|user|users>


Can you help me figure out what I am doing wrong? I tried to follow the error back but every change led to another error. I have removed the folder ID intentionally. 

Thank you in advance!

Carleigh

Ross Scroggs

unread,
Jan 8, 2025, 1:40:51 PM1/8/25
to google-ap...@googlegroups.com
There are non-breaking spaces instead of regular spaces around <email>; are you copy/pasting the command lime?

Send me a Meet/Zoom invitation and I'll help.

Ross
----
Ross Scroggs



Carleigh Duncan

unread,
Jan 8, 2025, 5:13:00 PM1/8/25
to GAM for Google Workspace
Hi Ross!
I was copying it from this thread. That said, I retyped the command out and that resolved the issue. 

Thank you again!

Carleigh

Reply all
Reply to author
Forward
0 new messages