Help with the filelist command

5,402 views
Skip to first unread message

Caleb Spring

unread,
Nov 3, 2016, 4:39:32 PM11/3/16
to GAM for G Suite
TLDR

Is there a command that can list all files under a folder recursively for a user?

Explanation 

We had a user move a folder that contain content of around 300 GB from its original shared location to his personal My Drive folder. This folder was synced locally to a Synology NAS drive. We caught this within an hour however the Google task kept running to move the folder and thus the folder was deleted locally when the sync program was sent the command to delete the folder. We reverted everything in Google Drive and users started updating files/folders again under this folder. We thought Synology Cloud Sync software would catch back up however it has been running for days and the data has not caught up yet. It is only at 59 GB of the 300 GB it once was. We have a backup and have restored that to the synology drive however now we need to compare the contents of the synology drive with the content in Google Drive to make sure we are not missing anything.  

I tried "gam user <username> show filelist name modifieddate > c:\gam\output\outputfile.csv" however the output was to large to manipulate as it is all files owned by that user which is close to 2 TBs of data. Is there a way to start in the folder that was moved and recursively output all the sub folders and files?






Ross Scroggs

unread,
Nov 3, 2016, 5:04:13 PM11/3/16
to google-ap...@googlegroups.com
Caleb,

Not with standard GAM; with this version: https://github.com/taers232c/GAMADV-X/releases
You would say: gam user <username> print filelist select anydrivefilename <Folder Name> showownedby any id title filepath > c:\gam\output\output file.csv
select anydrivefilename <Folder Name> - selects the folder to start with (even if <username> doesn't own it)
showownedby any - says to show files owned by any one
id title filepath - fields to output

GAMADV-X is a big and powerful, read the Gam*.txt files to see what's involved.

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/e4108011-467e-4da8-9af0-400284819a83%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Caleb Spring

unread,
Nov 4, 2016, 12:19:29 PM11/4/16
to GAM for G Suite
This is exactly what I needed. Thanks.

And you weren't kidding this is a beast. I will be reading the gam*.txt files for days ;)

Thanks again. 


On Thursday, November 3, 2016 at 5:04:13 PM UTC-4, Ross Scroggs wrote:
Caleb,

Not with standard GAM; with this version: https://github.com/taers232c/GAMADV-X/releases
You would say: gam user <username> print filelist select anydrivefilename <Folder Name> showownedby any id title filepath > c:\gam\output\output file.csv
select anydrivefilename <Folder Name> - selects the folder to start with (even if <username> doesn't own it)
showownedby any - says to show files owned by any one
id title filepath - fields to output

GAMADV-X is a big and powerful, read the Gam*.txt files to see what's involved.

Ross
On Thu, Nov 3, 2016 at 1:39 PM, Caleb Spring <csp...@tonesvaisey.com> wrote:
TLDR

Is there a command that can list all files under a folder recursively for a user?

Explanation 

We had a user move a folder that contain content of around 300 GB from its original shared location to his personal My Drive folder. This folder was synced locally to a Synology NAS drive. We caught this within an hour however the Google task kept running to move the folder and thus the folder was deleted locally when the sync program was sent the command to delete the folder. We reverted everything in Google Drive and users started updating files/folders again under this folder. We thought Synology Cloud Sync software would catch back up however it has been running for days and the data has not caught up yet. It is only at 59 GB of the 300 GB it once was. We have a backup and have restored that to the synology drive however now we need to compare the contents of the synology drive with the content in Google Drive to make sure we are not missing anything.  

I tried "gam user <username> show filelist name modifieddate > c:\gam\output\outputfile.csv" however the output was to large to manipulate as it is all files owned by that user which is close to 2 TBs of data. Is there a way to start in the folder that was moved and recursively output all the sub folders and files?






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



--

Grant D

unread,
Jun 5, 2017, 9:18:04 PM6/5/17
to GAM for G Suite
Hi Ross, 
Is there a way to also add file permissions to fields to output? 
I'm trying to assist with a SOX report, and I need to take what you have here, but also list out who has access to these files. 

Thanks,
Grant


On Thursday, November 3, 2016 at 2:04:13 PM UTC-7, Ross Scroggs wrote:
Caleb,

Not with standard GAM; with this version: https://github.com/taers232c/GAMADV-X/releases
You would say: gam user <username> print filelist select anydrivefilename <Folder Name> showownedby any id title filepath > c:\gam\output\output file.csv
select anydrivefilename <Folder Name> - selects the folder to start with (even if <username> doesn't own it)
showownedby any - says to show files owned by any one
id title filepath - fields to output

GAMADV-X is a big and powerful, read the Gam*.txt files to see what's involved.

Ross
On Thu, Nov 3, 2016 at 1:39 PM, Caleb Spring <csp...@tonesvaisey.com> wrote:
TLDR

Is there a command that can list all files under a folder recursively for a user?

Explanation 

We had a user move a folder that contain content of around 300 GB from its original shared location to his personal My Drive folder. This folder was synced locally to a Synology NAS drive. We caught this within an hour however the Google task kept running to move the folder and thus the folder was deleted locally when the sync program was sent the command to delete the folder. We reverted everything in Google Drive and users started updating files/folders again under this folder. We thought Synology Cloud Sync software would catch back up however it has been running for days and the data has not caught up yet. It is only at 59 GB of the 300 GB it once was. We have a backup and have restored that to the synology drive however now we need to compare the contents of the synology drive with the content in Google Drive to make sure we are not missing anything.  

I tried "gam user <username> show filelist name modifieddate > c:\gam\output\outputfile.csv" however the output was to large to manipulate as it is all files owned by that user which is close to 2 TBs of data. Is there a way to start in the folder that was moved and recursively output all the sub folders and files?






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



--

Ross Scroggs

unread,
Jun 5, 2017, 10:09:33 PM6/5/17
to google-ap...@googlegroups.com
Grant,

You can choose the fields you want; permissions in this case.

gam <UserTypeEntity> print|show filelist [todrive [<ToDriveAttributes>] [anyowner|(showownedby any|me|others)]

        [query <QueryDriveFile>] [fullquery <QueryDriveFile>] [<DriveFileQueryShortcut>] [select <DriveFileEntityListTree>] [depth <Number>]

        [filepath] [allfields|<DriveFieldName>*|(fields <DriveFieldNameList>)] (orderby <DriveFileOrderByFieldName> [ascending|descending])* [delimiter <String>]


Use fields <DriveFieldNameList>

<DriveFieldName> ::=

        appdatacontents|

        cancomment|

        canreadrevisions|

        capabilities|

        copyable|

        createddate|createdtime|

        description|

        editable|

        explicitlytrashed|

        fileextension|

        filesize|

        foldercolorrgb|

        fullfileextension|

        hasaugmentedpermissions|

        headrevisionid|

        iconlink|

        id|

        isappauthorized|

        lastmodifyinguser|

        lastmodifyingusername|

        lastviewedbyme|lastviewedbymedate|lastviewedbymetime|lastviewedbyuser|

        md5|md5checksum|md5sum|

        mime|mimetype|

        modifiedbyme|modifiedbymedate|modifiedbymetime|modifiedbyuser|

        modifieddate|modifiedtime|

        name|

        originalfilename|

        ownedbyme|

        ownernames|

        owners|

        parents|

        permissions|

        quotabytesused|quotaused|

        restricted|

        shareable|

        shared|

        sharedwithmedate|sharedwithmetime|

        sharinguser|

        size|

        spaces|

        starred|

        teamdriveid|

        thumbnaillink|

        title|

        trashed

        trasheddate|trashedtime|

        trashinguser|

        userpermission|

        version|

        viewed|

        viewerscancopycontent|

        webcontentlink|

        webviewlink|

        writerscanshare

<DriveFieldNameList> ::= "<DriveFieldName>(,<DriveFieldName>)*"


gam user <username> print filelist select anydrivefilename <Folder Name> showownedby any fields id,title,file path,permissions > c:\gam\output\output file.csv
select anydrivefilename <Folder Name> - selects the folder to start with (even if <username> doesn't own it)
showownedby any - says to show files owned by any one
fields id,title,file path,permissions - fields to output


Ross

On Mon, Jun 5, 2017 at 9:16 PM, Grant D <gyos...@gmail.com> wrote:
Hi Ross, 
Is there a way to also add file permissions to fields to output? 
I'm trying to assist with a SOX report, and I need to take what you have here, but also list out who has access to these files. 

Thanks,
Grant


On Thursday, November 3, 2016 at 2:04:13 PM UTC-7, Ross Scroggs wrote:
Caleb,

Not with standard GAM; with this version: https://github.com/taers232c/GAMADV-X/releases
You would say: gam user <username> print filelist select anydrivefilename <Folder Name> showownedby any id title filepath > c:\gam\output\output file.csv
select anydrivefilename <Folder Name> - selects the folder to start with (even if <username> doesn't own it)
showownedby any - says to show files owned by any one
id title filepath - fields to output

GAMADV-X is a big and powerful, read the Gam*.txt files to see what's involved.

Ross
On Thu, Nov 3, 2016 at 1:39 PM, Caleb Spring <csp...@tonesvaisey.com> wrote:
TLDR

Is there a command that can list all files under a folder recursively for a user?

Explanation 

We had a user move a folder that contain content of around 300 GB from its original shared location to his personal My Drive folder. This folder was synced locally to a Synology NAS drive. We caught this within an hour however the Google task kept running to move the folder and thus the folder was deleted locally when the sync program was sent the command to delete the folder. We reverted everything in Google Drive and users started updating files/folders again under this folder. We thought Synology Cloud Sync software would catch back up however it has been running for days and the data has not caught up yet. It is only at 59 GB of the 300 GB it once was. We have a backup and have restored that to the synology drive however now we need to compare the contents of the synology drive with the content in Google Drive to make sure we are not missing anything.  

I tried "gam user <username> show filelist name modifieddate > c:\gam\output\outputfile.csv" however the output was to large to manipulate as it is all files owned by that user which is close to 2 TBs of data. Is there a way to start in the folder that was moved and recursively output all the sub folders and files?






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



--

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

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



--

Grant D

unread,
Jun 6, 2017, 4:38:05 PM6/6/17
to GAM for G Suite
Hi Ross, 
Thanks for the quick response here. 
That syntax works well, however, is there a way to run this similar command but search via folder ID and all show all subfolders. 
I'm reviewing the report that I retrieved, and I'm worried I've got too many root folders with the same name. 
I wanted to see if there's a way to direct the search using the show filetree option? 
Thanks,
Grant
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@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.
Visit this group at https://groups.google.com/group/google-apps-manager.



--

Grant D

unread,
Jun 6, 2017, 4:56:38 PM6/6/17
to GAM for G Suite
Hi Ross, 
Wanted to be more specific, as I just re-read my last question. 
I've got a folder ID, which is a root folder shared by one of our teams.  I have the owner of this folder.  I'd like to be able to run a report to view all sub folders and sub files, and who has access to these objects. 
Please let me know if this is capable.
Thanks,
Grant

Ross Scroggs

unread,
Jun 6, 2017, 6:13:59 PM6/6/17
to google-ap...@googlegroups.com
Grant,

gam user folde...@domain.com show filelist select id 999jnewfiM5G8VlBqNDlsSmdDU2c fields id,title,permissions


Ross


To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsubscribe...@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+unsubscribe...@googlegroups.com.

To post to this group, send email to google-ap...@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.

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



--

Grant D

unread,
Jun 8, 2017, 9:58:26 PM6/8/17
to GAM for G Suite
Hi Ross, 
Thanks for getting me one step closer.  
Is there a way to incorporate the "showownedby any' with this command? 
This is a pretty large folder, with a lot of sub folders, and unfortunately, there are some files that were created by external users.  
Thanks, 
Grant

To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@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.
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-ap...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.



--

Ross Scroggs

unread,
Jun 8, 2017, 10:17:04 PM6/8/17
to google-ap...@googlegroups.com
Grant,

gam <UserTypeEntity> print|show filelist [todrive [<ToDriveAttributes>]] [corpora <CorporaAttribute>] [anyowner|(showownedby any|me|others)]
        [query <QueryDriveFile>] [fullquery <QueryDriveFile>] [<DriveFileQueryShortcut>] [select <DriveFileEntityListTree>] [depth <Number>]
        [filepath] [allfields|<DriveFieldName>*|(fields <DriveFieldNameList>)] (orderby <DriveFileOrderByFieldName> [ascending|descending])* [delimiter <String>]
Add showownedby any

gam user folde...@domain.com show filelist select id 999jnewfiM5G8VlBqNDlsSmdDU2c fields id,title,permissions showownedby any

Ross

To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.

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

Grant D

unread,
Jun 12, 2017, 3:23:05 PM6/12/17
to GAM for G Suite
Hi Ross, 
That again gets me closer. 
How can I limit or select what columns are outputted for the "permissions" field?
I tried selecting "shairinguser" using <> and using quotes, but can't seem to figure out the syntax. 

Basically, we just need a list of all the files in this Folder and the person's email address who might have access to the file.
We don't need PhotoLink, Domain, permission.0, or any of the other fields. 
I've read the gamCommands.txt, but don't see a syntax example to get this granular. 

Thanks,
Grant
Grant,

Grant D

unread,
Aug 17, 2017, 9:12:38 PM8/17/17
to GAM for G Suite
Hi Ross, 
I have a situation where someone shared some confidential information to anyone with link.  We were trying to run a report using the lastviewedbyuser flag. 
When we tried this flag the report errors about syntax.  
I also tried the allfields flag and noticed that I only get information for the account i'm running on behalf of for when the file was viewed (lastViewedByMeDate) 
Is there a way with gam advanced to run a report to just see who viewed the contents of a folder during a 4 day span? 

Thanks,
Grant

Ross Scroggs

unread,
Aug 17, 2017, 10:18:20 PM8/17/17
to google-ap...@googlegroups.com
Grant,

GAM or GAMADV-X should be able to do this.
Let's call the sharing user dopey.
We need the folder id: gam user dopey show fileinfo drivefilename "Put Folder Name Here" id
Now we run a report: gam report drive start 2017-08-10T00:00:00Z end 2017-08-14T23:59:59Z filters "doc_id==Put ID Here" event view > report.csv
There will be many columns for each event; you're looking for a pair of columns: parameters.N.name and parameters.N.value where the parameters.N.name is target_user; parameters.N.value is the viewing user.

Ross
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.

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

Grant D

unread,
Aug 22, 2017, 8:45:43 PM8/22/17
to GAM for G Suite
Hi Ross, 
Thanks, I think that got us exactly what we were looking for. 
Thanks,
Grant
Reply all
Reply to author
Forward
0 new messages