Using GAM to find the size of a Google Drive folder

4,894 views
Skip to first unread message

Constantly Learning

unread,
Oct 26, 2017, 5:21:28 PM10/26/17
to GAM for G Suite
Hoping somebody can help me. I've looked for the answer to this question but can't find it. 

Using GAM,  I want to see what how much data (e.g. 20MB, 3.3G) is contained in a folder. 

Let's say the folder is titled Client XYZ and it contains tons of files and subfolders.

I tried this:

gam user mye...@mydomain.com show filelist filesize query "name contains 'Client XYZ'"

That throws this error:

ERROR: 400: Invalid query - invalid
 got 0 files for mye...@mydomain.com...
Owner,fileSize

I then tried getting any GAM command to work with a query on the name variable, and it never works.  The query part works fine for other parameters defined here: https://developers.google.com/drive/v3/web/search-parameters

So can you not query on name? And is there a better way to do what I want to do? Thanks tons to whoever can answer this one for me. Really appreciate it and LOVE Gam, btw.


Ross Scroggs

unread,
Oct 26, 2017, 5:41:45 PM10/26/17
to google-ap...@googlegroups.com
Ken,

You want title not name.
But you're not going to get the data you expect.

fileSizelongThe size of the file in bytes. This field is only populated for files with content stored in Drive; it is not populated for Google Docs or shortcut files.

Ross

--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.
To post to this group, send email to google-apps-manager@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/fbd9ceba-6cdb-4772-9ccb-b2edf969b510%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Constantly Learning

unread,
Oct 26, 2017, 5:56:12 PM10/26/17
to GAM for G Suite
Thanks, Ross. Appreciate the help. 

That did make the GAM command execute but as you predicted, it doesn't do what I need. 

I'm not worried about the shortcuts part because my folder doesn't contain any shortcuts. It is a backup of a folder on my local hard drive.

But while it gives filesizes for every file with "Client XYZ" in the name, it lists out the folder in the results with no filesize. 

If I can't get the folder's size, is there any way to list out all files in Client XYZ, including files in subfolders? Then I could just add the sizes of each file up to get the total space used. 

The scenario here is as follows. Let's say Client XYZ folder on my laptop is 303MB and I put it up to drive as a backup because I want to clear that space up on my laptop. Before I delete the folder on my laptop, I'd like to know that all 303MB made it up to Google Drive. I was hoping I could right-click on a Drive folder and see how big it is, but no luck. After that, I was thinking GAM could do the trick, but no luck yet. Any ideas?

Thanks tons.

Ross Scroggs

unread,
Oct 26, 2017, 7:29:30 PM10/26/17
to google-ap...@googlegroups.com
Ken,

Show me the command you're executing? Is there a single folder name Client XYZ or many files/folders with that name?

Ross



--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.
To post to this group, send email to google-apps-manager@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.

For more options, visit https://groups.google.com/d/optout.



--

Ross Scroggs

unread,
Oct 26, 2017, 7:42:45 PM10/26/17
to google-ap...@googlegroups.com
Ken,

It's not just shortcuts, no Google Docs/Sheets/Slides/... will have sizes.

With standard Gam you can't get the list of files you want; with my Advanced Gam (https://github.com/taers232c/GAMADV-X) you can.
Let's call the top level folder "Top Folder" (substitute accordingly).

gam redirect csv ./MyTopFolderFiles.csv user mye...@mydomain.com print filelist select drivefilename "Top Folder" fields id,title,filesize

Ross

On Thu, Oct 26, 2017 at 4:29 PM, Ross Scroggs <ross.s...@gmail.com> wrote:
Ken,

Show me the command you're executing? Is there a single folder name Client XYZ or many files/folders with that name?

Ross


On Thu, Oct 26, 2017 at 2:56 PM, Constantly Learning <k...@walkersands.com> wrote:
Thanks, Ross. Appreciate the help. 

That did make the GAM command execute but as you predicted, it doesn't do what I need. 

I'm not worried about the shortcuts part because my folder doesn't contain any shortcuts. It is a backup of a folder on my local hard drive.

But while it gives filesizes for every file with "Client XYZ" in the name, it lists out the folder in the results with no filesize. 

If I can't get the folder's size, is there any way to list out all files in Client XYZ, including files in subfolders? Then I could just add the sizes of each file up to get the total space used. 

The scenario here is as follows. Let's say Client XYZ folder on my laptop is 303MB and I put it up to drive as a backup because I want to clear that space up on my laptop. Before I delete the folder on my laptop, I'd like to know that all 303MB made it up to Google Drive. I was hoping I could right-click on a Drive folder and see how big it is, but no luck. After that, I was thinking GAM could do the trick, but no luck yet. Any ideas?

Thanks tons.

--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsubscribe...@googlegroups.com.

To post to this group, send email to google-apps-manager@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.



--



--

Constantly Learning

unread,
Oct 27, 2017, 5:40:49 AM10/27/17
to GAM for G Suite
Ross,

Thanks tons. I will try your Advanced Gam over the weekend and let you know how it goes. So appreciate what you have done for admins, as well as what Jay did with the original Gam.

Previous command I was running was something like this

gam user mye...@mydomain.com show filelist name filesize query "title contains 'Top Folder'" todrive

But that's no longer relevant since it seems I need Advanced Gam to get what I want. Thanks again.

Ken

Constantly Learning

unread,
Oct 27, 2017, 6:50:49 AM10/27/17
to GAM for G Suite
Ross, 

Decided to just go for it this morning, and it worked perfectly. Gave me a full inventory of every folder and file in my top-level folder, and I was able to verify the total filesize, the number of folders and the number of files. Perfect and exactly what I needed. Thank you!

Ken

Raju Vemula

unread,
Feb 17, 2023, 6:41:00 AM2/17/23
to GAM for Google Workspace
Team,

Can someone help me how to print / list all users google drive size and export to CSV?

Ross Scroggs

unread,
Feb 17, 2023, 10:14:19 AM2/17/23
to google-ap...@googlegroups.com
Raju,

gam report users parameters accounts:drive_used_quota_in_mb,accounts:total_quota_in_mb,accounts:used_quota_in_mb,accounts:used_quota_in_percentage > DriveUsage.csv


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/686501dc-8e80-463e-8c11-607cafe39421n%40googlegroups.com.


--
Reply all
Reply to author
Forward
0 new messages