Syntax for transferring ownership of files with a list of folder IDs

50 views
Skip to first unread message

Allen Hancock

unread,
May 30, 2025, 2:04:03 PM5/30/25
to GAM for Google Workspace

I've got a two lists of google drive folders which I need to transfer ownership from us...@example.com to us...@example.com.

There's a parent folder (FolderA) in userB's MyDrive
I have a list of folder IDs owned by UserA which are at the root of FolderA (level-one-folders-to-transfer.txt)
I have another list of folder IDs which are owned by UserA, those are all children of folders in level-one-folders-to-transfer.txt.
(level-two-folders-to-transfer.txt)

I don't want to move any of the folders away from their existing parent, and I wish to retain all existing permissions files or folders inside folders who's ownership is being changed.

I feel like I'm using the correct options, but I am not sure how to reference the folders.. I think I don't  follow how to use "DriveFileEntity"

gam user us...@example.com transfer ownership csv level-one-folders-to-transfer.txt us...@example.com norecursion true

Here's what I get:

% gam user us...@example.com transfer ownership csv level-one-folders-to-transfer.txt us...@example.com norecursion true preview
Command: ~/bin/gam7/gam user us...@example.com transfer ownership csv >>>level-one-folders-to-transfer.txt<<< us...@example.com norecursion true preview

ERROR: Invalid argument: Expected <FileName(:FieldName)+>
Help: Syntax in file ~/bin/gam7/GamCommands.txt
Help: Documentation is at https://github.com/GAM-team/GAM/wiki

% gam version
GAM 7.07.14 - https://github.com/GAM-team/GAM - pyinstaller
GAM Team <google-ap...@googlegroups.com>
Python 3.13.3 64-bit final
MacOS Sequoia 15.5 arm64
Path: ~/bin/gam7
Config File: ~/.gam/gam.cfg, Section: example-usera, customer_id: xxxxxxxxx, domain: example.com
Time: 2025-05-30T17:57:00+00:00


Do I need to create the txt files as csv's with a specific header?

The list of folders could also be found in a named range in a google sheet.. would it be possible (or better) to use that as a source?

Thanks all

-Allen





Ross Scroggs

unread,
May 30, 2025, 2:06:51 PM5/30/25
to google-ap...@googlegroups.com
Send me a private Meet/Zoom invitation and I'll help.

Ross
----
Ross Scroggs



--
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 visit https://groups.google.com/d/msgid/google-apps-manager/b0f828ea-1e5e-4113-bd8f-f9a597249cf6n%40googlegroups.com.

Ross Scroggs

unread,
May 30, 2025, 2:17:57 PM5/30/25
to google-ap...@googlegroups.com

Do I need to create the txt files as csv's with a specific header?
Yes, I'm assuming that each of your two files have a column of file IDs, one per row.
The should be a header row with the valid id

Test with the preview option, then remove it to perform the transfer.

gam user us...@example.com transfer ownership csvfile level-one-folders-to-transfer.txt:id us...@example.com norecursion true preview

Ross
----
Ross Scroggs


On May 30, 2025, at 11:02 AM, 'Allen Hancock' via GAM for Google Workspace <google-ap...@googlegroups.com> wrote:

Allen Hancock

unread,
May 30, 2025, 4:17:31 PM5/30/25
to google-ap...@googlegroups.com
Thanks so much for the call.

What you showed me was that the syntax I needed (along with having the first line of my file be "id") was

gam user us...@example.com transfer ownership csvfile level-one-folders-to-transfer.txt:id us...@example.com norecursion true preview

and you helped me upgrade the command to using a google sheet directly, and in batches of 20 vs 1 at a time (this example let me test just the first 10 rows.. otherwise I could remove maxrows 10)

gam config num_threads 20 redirect stdout ./firstlevel-output.txt multiprocess redirect stderr stdout csv gsheet us...@example.com GSHEET_ID_WITH_COLUMN_OF_DATA id:SHEET_ID skiprows 0 maxrows 10 gam user us...@example.com transfer ownership "~id" us...@example.com norecursion true

Wonderful!





You received this message because you are subscribed to a topic in the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-manager/7M61O9kjc1o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apps-man...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-apps-manager/2863DDFB-BF4C-4D7D-8D37-C4494E85B6FF%40gmail.com.
Reply all
Reply to author
Forward
0 new messages