All files from All Team Drives

542 views
Skip to first unread message

Haim Ziv

unread,
Oct 23, 2017, 7:51:47 AM10/23/17
to GAM for G Suite
Hi,

I am using this command which show me all users, and all the files (for each user)

that means that if 3 users are using the same team drives, I am getting duplicate information of the same file

gam config auto_batch_min 1 redirect csv ./AllUsersAllTeams1.csv multiprocess all users print filelist corpora allteamdrives filepath fields id,name

How can I get a list of all the files in my org team drives?

This is what I am getting now:

us...@mydomain.com 0BzB-X0C5XtZmMms4NjJuYX11lnZHM Macys Holiday Sale Images.xlsx Team Drive (Test)\Macy's Holiday Sale Images\Macys Holiday Sale Images.xlsx
us...@mydomain.com 0BzB-X0C5XtZmMms4NjJuYX11lnZHM Macys Holiday Sale Images.xlsx Team Drive (Test)\Macy's Holiday Sale Images\Macys Holiday Sale Images.xlsx

This is what I would like to get

0BzB-X0C5XtZmMms4NjJuYX11lnZHM Macys Holiday Sale Images.xlsx Team Drive (Test)\Macy's Holiday Sale Images\Macys Holiday Sale Images.xlsx

Thanks!!!

Haim Ziv

unread,
Oct 23, 2017, 2:56:19 PM10/23/17
to GAM for G Suite
I am also looking for a way to get all files and folders on a team drive, by giving the drive id

בתאריך יום שני, 23 באוקטובר 2017 בשעה 14:51:47 UTC+3, מאת Haim Ziv:

Ross Scroggs

unread,
Oct 23, 2017, 3:10:31 PM10/23/17
to google-ap...@googlegroups.com
Haim,


gam user us...@domain.com print filelist select teamdriveid <PutTeamDriveIdHere> filepath fields id,name
or
gam user us...@domain.com print filelist select teamdrive <PutTeamDriveNameHere> filepath fields id,name

Here is a solution that may help with your larger question.

Get a list of Team Drives for all users but only if the user is an organizer.

gam config auto_batch_min 1 redirect csv ./UsersTeamDriveOrganizers.csv multiprocess all users print teamdrives role organizer


Get a list of files for each of those User/Team Drive combinations.

gam redirect csv ./TeamDriveFiles.csv multiprocess csv ./UsersTeamDriveOrganizers.csv gam user ~User print filelist select teamdriveid ~id filepath fields id,name


This will still show duplicate files if a Team Drive has multiple organizers.

I'll work on a script to eliminate the duplicates.

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/3962df85-e35a-4fca-94ce-09b722177a96%40googlegroups.com.

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



--

Haim Ziv

unread,
Oct 23, 2017, 3:19:30 PM10/23/17
to google-ap...@googlegroups.com
Thanks! MUCH APPRECIATED!!!

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.



--

--
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.

Ross Scroggs

unread,
Oct 23, 2017, 8:44:32 PM10/23/17
to google-ap...@googlegroups.com
Haim,

Here's the script to delete the duplicate rows from your file list.

Ross

Thanks! MUCH APPRECIATED!!!

--
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.



--

Haim Ziv

unread,
Oct 24, 2017, 9:20:02 AM10/24/17
to GAM for G Suite
Hi Ross, 

Few updates about it. I think there is a bug maybe, let me explain

I've started with this command which runs fine, but some team drives was missing

C:\gamadvx-64>gam config auto_batch_min 1 redirect csv ./UsersTeamDrivesOrga1.csv multiprocess all users print teamdrives role organizer

so, I've decided to remove the organizer role and try again

C:\gamadvx-64>gam config auto_batch_min 1 redirect csv ./UsersTeamDrivesOrga2.csv multiprocess all users print teamdrives

This time, I've got all the team drives. next, I've run this PowerShell command to clear the duplicates from the file

import-csv .\UsersTeamDrivesOrga2.csv | sort name -Unique  | Export-Csv .\UsersTeamDrivesOrga2un.csv

Now, I've run the command you provided in order to get all the files in these drives

C:\gamadvx-64>gam redirect csv ./24OctTeamDriveFiles.csv multiprocess csv ./UsersTeamDrivesOrga2un.csv gam user ~User print filelist select teamdriveid ~id filepath fields id,name

I've waited for more than an hour (it's still running while I am typing this message) and it's stuck on a message

Using 5 processes...

So, I've decided to run another command in another window in order to try a different approach

C:\gamadvx-64>gam config auto_batch_min 1 redirect csv ./AllUsersAllTeams2.csv multiprocess csv ./UsersTeamDrivesOrga2un.csv gam user ~User print filelist corpora allteamdrives filepath fields id,name

and it finished within 30 min, the other one is still running 

is this command really runs in multiprocess? because it seems only one is opened

C:\gamadvx-64>gam redirect csv ./24OctTeamDriveFiles.csv multiprocess csv ./UsersTeamDrivesOrga2un.csv gam user ~User print filelist select teamdriveid ~id filepath fields id,name















בתאריך יום שלישי, 24 באוקטובר 2017 בשעה 03:44:32 UTC+3, מאת Ross Scroggs:
Thanks! MUCH APPRECIATED!!!

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-ap...@googlegroups.com.



--

--
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-ap...@googlegroups.com.

--
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-ap...@googlegroups.com.



--

Haim Ziv

unread,
Oct 24, 2017, 10:30:28 AM10/24/17
to GAM for G Suite
Another update, it just finished after 2.5 hours of running

C:\gamadvx-64>gam redirect csv ./24OctTeamDriveFiles.csv multiprocess csv ./UsersTeamDrivesOrga2un.csv gam user ~User print filelist select teamdriveid ~id filepath fields id,name


בתאריך יום שלישי, 24 באוקטובר 2017 בשעה 16:20:02 UTC+3, מאת Haim Ziv:
Reply all
Reply to author
Forward
0 new messages