search for a file in all shared drives

495 views
Skip to first unread message

Temple Rodgers

unread,
Sep 17, 2021, 9:31:01 AM9/17/21
to GAM for Google Workspace
Hi y'all .. I'm doing a simple search for a file, I know the exact name, this isn't working ...
gam config csv_output_row_filter "name:regex:^filename.txt" print teamdrive

the drives are scanned and the headers are output but no rows of data.

A supplementary Q - can I search all Users' MyDrives for a file?

Thank you

Ross Scroggs

unread,
Sep 17, 2021, 10:05:19 AM9/17/21
to google-ap...@googlegroups.com
Temple,

Your command is looking for a Shared Drive named filename.txt, not what you're looking for.

The process in more complicated; you have to search by user. GAMADV-XTD3 6.07.26 or later is required.

gam config auto_batch_min 1 multiprocessexit rc=0 redirect stdout - multiprocess redirect stderr stdout all users print filelist query "name='filename.txt'" fields id,name,driveid filepath corpora alldrives 
config auto_batch_min 1- Do parallel processing
multiprocessexit rc=0 - Stop processing when the file is found
redirect stdout - multiprocess redirect stderr stdout - Make the progress messages clean
all users - Look at everybody 
print filelist query "name='filename.txt'" - Command to list the file
fields id,name,driveid filepath - Specify output
corpora alldrives - Make the search include Shared Drives; omit to only look at My Drives

Ross


Disclaimers apply, for full details see: https://hackney.gov.uk/email-disclaimer



--
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/a2b5d691-9d87-4a0e-906f-bd1b5d8db788n%40googlegroups.com.

Temple Rodgers

unread,
Sep 17, 2021, 10:07:00 AM9/17/21
to GAM for Google Workspace
thank you @ross - I'll give it a try now. GAM-XTD3 was updated earlier today.
Temple

Temple Rodgers

unread,
Sep 17, 2021, 10:25:17 AM9/17/21
to GAM for Google Workspace
oof! .. Linux doesn't like the exclamation point which is in the filename ... I tried /\! but GAM took it literally so then I tried using a + instead of the ! but not the :regex ..  but then I found out I can type set +H before and set -H after which turns history expansion off then on.

Temple Rodgers

unread,
Sep 17, 2021, 10:42:03 AM9/17/21
to GAM for Google Workspace
yep, that works, thank you. Is there a way of preventing thousands of lines? thus:
      Getting all Drive Files/Folders that match query ((name='b02%001!.PDF')) for aa....b@h.co.uk

      Got 0 Drive Files/Folders that matched query ((name='b02%001!.PDF')) for aa.....b@h.co.uk...

....
until the match is found
Reply all
Reply to author
Forward
0 new messages