taers232c / GAMADV-XTD3

Command line tool to manage Google Workspace
715 stars 87 forks source link

Getting File IDs with Owners Bulk Operation #218

Closed wallarug closed 2 years ago

wallarug commented 2 years ago

Hi there,

I have a top level folder that has a large number of files in it (99k+) that need to be searched and have a user removed.

The plan is to get all the files into a CSV with their current owner and then process each file individually using gam csv file.csv gam user <OwnerUserID> delete drivefileacls <FileID> <DeleteUserID> and the data colleceted.

I am having an issue. I tested the below command and it does grab all the file ids correctly, however, it doesn't give the owners correctly. It outputs the owner as the top level folder owner for each file (which is not the case).

gam user <FolderOwnerAccount> print filelist select id:<FolderID> showownedby any id > FilesAndFolders.csv

I am new to GAM. I am not sure if this is a bug or expected behaviour for the above command. I would have thought it should give me the real file owners instead of just listing out the top level folder owner (which is not the same user).

Any advice for this one would be great.

taers232c commented 2 years ago

The Ower column show be labelled User

gam redirect csv FilesAndFolders.csv user print filelist select id: showownedby any fields id,owners.emailaddress

Ross

On Tue, Nov 9, 2021 at 8:29 PM wallarug @.***> wrote:

Hi there,

I have a top level folder that has a large number of files in it (99k+) that need to be searched and have a user removed.

The plan is to get all the files into a CSV with their current owner and then process each file individually using gam csv and the data colleceted.

I am having an issue. I tested the below command and it does grab all the file ids correctly, however, it doesn't give the owners correctly. It outputs the owner as the top level folder owner for each file (which is not the case).

gam user print filelist select id: showownedby any id > FilesAndFolders.csv

I am new to GAM. I am not sure if this is a bug or expected behaviour for the above command. I would have thought it should give me the real file owners instead of just listing out the top level folder owner (which is not the same user).

Any advice for this one would be great.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/taers232c/GAMADV-XTD3/issues/218, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCTYLYSI4SENKVN4N4CVMDULHYK5ANCNFSM5HW5PL2A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

-- Ross Scroggs @.***

wallarug commented 2 years ago

Thanks mate! Works like a charm!