Syntax of GAM csv

3,306 views
Skip to first unread message

Philip Nash

unread,
May 16, 2017, 8:02:59 PM5/16/17
to GAM for G Suite
Hello,

I am a new GAM user. I am using GAM 4.21 on Windows 10.

I would like to change the ownership of all of one users files to another user. I have created a csv file using,
"gam user ~email1 show filelist todrive"

I then thought the following command would run through the list of files in the csv and change the ownership of each,
"gam csv Input.csv gam user ~email1 update ~email2 role owner".

However this flags the second user's email address as an invalid argument. I realise that for a single file update, i.e. not using gam csv, there would be a "drivefileacl <file id>" after the "update" argument.

How do I get the command to pick up the file id from the csv file? 

Regards

Phil Nash

Ross Scroggs

unread,
May 16, 2017, 8:54:55 PM5/16/17
to google-ap...@googlegroups.com
Philip,

gam user ~email1 show filelist todrive 
Where is the value for ~email1 coming from? Specifying todrive gets you a CSV file on Google Drive, not locally.

gam user us...@domain.com show filelist id > Input.csv
This gives you Input.csv with headers: Owner,id

gam csv Input.csv gam user ~Owner add drivefileacl ~id user us...@domain.com role owner
~Owner gets the current owner (us...@domain.com) from the CSV file
~id gets the file id from the CSV command
This makes user2 the owner of user1's files and demotes user1 to a writer. Do you want user1 to retain any rights/role to the files?
If not, do this: gam csv Input.csv gam user ~Owner delete drivefileacl ~id ~Owner

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/6c2998f5-48f2-41a6-ac5e-b85ab9e86ff4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

✉ Kevin Melillo

unread,
May 17, 2017, 8:48:55 AM5/17/17
to google-ap...@googlegroups.com
Good morning,

Using GAM you can script the switching of owners as well as the removal of the old user totally.  

If all you need to do is switch the owner of the file, you can do that via the Admin Control Panel \ Apps \ Drive interface.  

There is no reason you need to do it via the Admin Panel, but I just wanted to give you the option, should you need it.

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.
Visit this group at https://groups.google.com/group/google-apps-manager.

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



--
Kevin Melillo
Electronic Communications Analyst
Information Technology
445 Hoes Lane
Piscataway, NJ 08854

Phone:732-465-6609 | Mobile: 732-609-4331

Ross Scroggs

unread,
May 17, 2017, 10:35:39 AM5/17/17
to google-ap...@googlegroups.com
Philip,

You can also do this as follows:
user1 retains role writer: gam user us...@domain.com transfer drive us...@domain.com keepuser
user1 retains no role: gam user us...@domain.com transfer drive us...@domain.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-man...@googlegroups.com.
To post to this group, send email to google-ap...@googlegroups.com.

Philip Nash

unread,
May 19, 2017, 9:38:33 AM5/19/17
to GAM for G Suite
Hi Ross,

Thank you for your very prompt reply and apologies for my tardy acknowledgement. Local internet issues being the culprit.

Thank you for your explanation. It all makes sense to me now. I misunderstood the use of the tilda. I hadn't read "notice the arguments starting with ~. For these arguments, GAM substitutes in the value from the CSV row" from the wiki.

I note that you have used the argument "add" as opposed to "update". Is there any reason?

In your second post you refer to "transfer drive" arguments, but I haven't seen them anywhere in the wiki.

A separate question I have concerns the folder structure in Google Drive. When using gam to list files, is there any way of listing only files in one folder and its sub-folders?

Thanks

Phil 


On Wednesday, 17 May 2017 15:35:39 UTC+1, Ross Scroggs wrote:
Philip,

You can also do this as follows:
user1 retains role writer: gam user us...@domain.com transfer drive us...@domain.com keepuser
user1 retains no role: gam user us...@domain.com transfer drive us...@domain.com

On May 16, 2017, at 1:04 PM, Philip Nash <pn...@oldwoughton.org.uk> wrote:

Hello,

I am a new GAM user. I am using GAM 4.21 on Windows 10.

I would like to change the ownership of all of one users files to another user. I have created a csv file using,
"gam user ~email1 show filelist todrive"

I then thought the following command would run through the list of files in the csv and change the ownership of each,
"gam csv Input.csv gam user ~email1 update ~email2 role owner".

However this flags the second user's email address as an invalid argument. I realise that for a single file update, i.e. not using gam csv, there would be a "drivefileacl <file id>" after the "update" argument.

How do I get the command to pick up the file id from the csv file? 

Regards

Phil Nash


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

Philip Nash

unread,
May 19, 2017, 9:42:50 AM5/19/17
to GAM for G Suite
Hi Kevin,

Thank you very much for your prompt reply.

There are follow up bulk actions I need to carry out using gam and not just ownership changes.

Thanks

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

Ross Scroggs

unread,
May 19, 2017, 12:02:36 PM5/19/17
to google-ap...@googlegroups.com
Phil,

I note that you have used the argument "add" as opposed to "update". Is there any reason?
gam csv Input.csv gam user ~Owner add drivefileacl ~id user us...@domain.com role owner
To use update, there has to be an existing ACL. With add, the new ACL is added/updated as necessary.

* In your second post you refer to "transfer drive" arguments, but I haven't seen them anywhere in the wiki.
Syntax:

gam <UserTypeEntity> transfer drive <UserItem> [keepuser]

Example:

gam oldo...@domain.com transfer drive newo...@domain.com keepuser


This copies/moves all files/folders belonging to oldowner to newowner into a folder named "oldo...@domain.com old files"; the file structure is maintained.

If keepuser is specified, this is a copy, otherwise it is a move.


* A separate question I have concerns the folder structure in Google Drive. When using gam to list files, is there any way of listing only files in one folder and its sub-folders?
Not in standard Gam, you can in my Advanced Gam: https://github.com/taers232c/GAMADV-X


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.



--
Kevin Melillo
Electronic Communications Analyst
Information Technology
445 Hoes Lane
Piscataway, NJ 08854

Phone:732-465-6609 | Mobile: 732-609-4331

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

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



--

Philip Nash

unread,
May 19, 2017, 1:25:06 PM5/19/17
to GAM for G Suite
Ross,

Thanks for your reply.Your explanations are clear. Are these explanations somewhere in the GitHub wiki that I haven't found yet, or is that a question for Jay Lee?

Ultimately what I am trying to do is to impose some structure on the permissions associated with our shared library of files, which numbers many thousands. Nearly all the files in our organisation are shared so that we can all collaborate more effectively. We are a local government organisation. There are specific top level folders for discreet areas of operation. I would like to control access exclusively through Google Groups to make managing personnel turn over more straight forward. Currently a number of permissions have been granted to individuals. I would also like to change permission, under specific top level folders, to view only.

To this end I would like to remove all existing permissions using gam and then use the standard Google Drive commands to re-allocate permissions on the top level folders so that all sub-folders and files will inherit the top level folder permissions.

The thing is some users have their own personal folders which may or may not be shared and I don't want to touch them. Hence my question about listing files under specific folders.

Am I going to be able to do this in gam or gamadv-x?

Sorry to load you with my problem.

Regards

Phil


On Friday, 19 May 2017 17:02:36 UTC+1, Ross Scroggs wrote:
Phil,

I note that you have used the argument "add" as opposed to "update". Is there any reason?
gam csv Input.csv gam user ~Owner add drivefileacl ~id user us...@domain.com role owner
To use update, there has to be an existing ACL. With add, the new ACL is added/updated as necessary.

* In your second post you refer to "transfer drive" arguments, but I haven't seen them anywhere in the wiki.
Syntax:

gam <UserTypeEntity> transfer drive <UserItem> [keepuser]

Example:

gam oldo...@domain.com transfer drive newo...@domain.com keepuser


This copies/moves all files/folders belonging to oldowner to newowner into a folder named "oldo...@domain.com old files"; the file structure is maintained.

If keepuser is specified, this is a copy, otherwise it is a move.


* A separate question I have concerns the folder structure in Google Drive. When using gam to list files, is there any way of listing only files in one folder and its sub-folders?
Not in standard Gam, you can in my Advanced Gam: https://github.com/taers232c/GAMADV-X


Ross


--

Ross Scroggs

unread,
May 22, 2017, 11:59:18 AM5/22/17
to google-ap...@googlegroups.com
Philip,

This is starting to get outside my area of knowledge. Is there some specific user that owns the top level folders?

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.



--

+KimNilsson

unread,
May 22, 2017, 3:53:07 PM5/22/17
to GAM for G Suite
Philip, and Ross, this could be accomplished with gamadv-x claim using proper excludes.
Of course, this needs some deep diving into the structure to find all the folders and file you wish to exclude, Philip.

As soon as all resources have been claimed, Philip should be able to run through the structure and remove ACLs from everything (apart from the excludes, of course), don't you think, Ross?

Then followed by manually adding access rights with proper groups to the right folders, just using Drive.

Philip Nash

unread,
May 23, 2017, 6:28:56 AM5/23/17
to GAM for G Suite
Ross and Kim,

Thanks for taking so much time with this.

What you outline, Kim, is what I was hoping might be possible. I have emailed all users (only 10) to find out if and what folders they might have that exist outside the shared folder library. It is possible there are none, other than those I have.

If this is the case, presumably, I could use just gam to list the files that each user owns and then, with these output files as input, could change the file ownership one user at a time.

Then, again using gam, I could remove all existing permissions for each user.

Finally use Drive to apply the new permissions to the top level folders so that all files and sub-folders inherit the new permissions.

Is that a workable scenario?

Regards

Phil
Reply all
Reply to author
Forward
0 new messages