Written by Paul Ogier on November 17, 2021

How to search your Google Drive for confidential files

This lesson is part of the "TAMING GAM - A practical guide to GAM and GAMADV-XTD3" course.

What confidential information do your staff have? Do some of them have access to credit card numbers that they are not supposed to know about? Are they sending out CVs on company time? Do they have company secrets saved on their Google Drive?

If I have scared you, I meant to. It is a nice way to get you hooked into a blog article 🙂

But if your staff have access and have saved this information in their Google Drives and you are not aware of it, you have no idea what they might want to do with that information in the future or maybe what they have already done with it.

Let's look at a very simple and quick way of searching your companies drives for information that you want to check for.

We are going to be looking for keywords using GAMADV-XTD3. If you are not sure how to install and get started with GAM, please see these articles.

GAMADV-XTD3 on Windows 10

GAMADV-XTD3 on Ubuntu Linux

GAMADV-XTD3 on macOS

GAMADV-XTD3 on Google Cloud Shell

If you are looking to upgrade your GAM then go to upgrade your installation of GAM?

Let's get started.

Firstly open up your command line, whether on Windows, macOS or Linux and type this command. This is searching through a user called Jim for the word "confidential".

gam user jim print filelist query "fullText contains 'confidential'" todrive

If you want to see all the fields in a Google Sheet, then you would use this command.

gam user jim print filelist query "fullText contains 'confidential'" allfields todrive

But what if you want to search for a Credit Card number in Google Drive? Well then this is what your script would look like. We are searching through everyone's Google Drive for a specific Credit Card number.

gam all users print filelist query "fullText contains '4539931860264108'" allfields todrive

Other Search Queries

File Content with Exact Phrase "Credit Card". I am just searching in Jim's Google Drive.

gam user jim print filelist query "fullText contains '\"Credit Card\"'" todrive

File Content with words in same file. I am looking for a file that has the CEO's Credit card number "4539931860264108" and the word "ID". Here I am searching through all the users.

gam all users print filelist query "fullText contains '4539931860264108 ID'" todrive

Exact File name. We are searching through just Jim's Google Drive for the Exact file name of "Confidential Document"

gam user jim print filelist query "title = 'Confidential Document'" todrive

Part of a File name. Here we are searching through all the users in the Google Workspace domain and trying to find all files that have the word "Confidential" somewhere in the file name.

gam all users print filelist fields title filenamematchpattern ".*Confidential*.*" todrive

External Sharing

In this article we looked at external sharing, but here are a couple more examples. Here we are searching for owners of documents. You can specify an email address.

gam all users print filelist id name owners fullquery "'paul@osh.co.za' in owners" anyowner todrive

This query looks at anyone with a link who can edit your Google Drive Documents.

gam all users print filelist fields id,name,permissions,webViewLink pm type anyone withlink true role editor em todrive

What is next?

Make sure that your staff are not sharing private or confidential information with others on the internet. If you would like more information about how to secure and report on your Google Workspace with automated and simple tools, check out the full "TAMING GAM - A practical guide to GAM and GAMADV-XTD3" course for your Google Workspace. It is over 9 hours and has 50 pages of free resources!

Related Posts