Get FolderID for multiple Folders within a Folder on My Drive

778 views
Skip to first unread message

Ian Bevan

unread,
Apr 14, 2021, 6:15:23 AM4/14/21
to GAM for Google Workspace
I'm in the process of copying lots of user folders to my My Drive in a Folder that I'll call AllUsers.
Each folder represents a user and is named as such.
What I'd like to know is how do I get a GSheet output with the following information so that I can then transfer ownership.
I will need the following:
folderName, folderID then I can quickly create another column with newOwner and build the email address from folderName.
I'm using GAMADV, if that makes a difference.

Brian Kim

unread,
Apr 14, 2021, 8:55:47 AM4/14/21
to GAM for Google Workspace
Assuming all the subfolders within AllUsers are at the root of the folder, and could be owned by the user you're impersonating or any other user

Try

gam redirect csv - todrive user username print filelist select drivefilename AllUsers showmimetype gfolder showownedby any depth 0 fields title,id

Ian Bevan

unread,
Apr 14, 2021, 9:49:10 AM4/14/21
to GAM for Google Workspace
If you live closer, I'd be giving you a big kiss.
That worked perfectly and has saved me soo much time.
Thanks so much Brian

Ian Bevan

unread,
Apr 23, 2021, 6:39:25 AM4/23/21
to GAM for Google Workspace
I'm now trying to use the output from the file that Brian helped and running a gam command to give ownership of the folder to a user.
The command runs, the folders are shared, but any of the documents that are within the folders are not and the end user cannot see them.
Any idea what I'm doing wrong?

The command I'm using is:
gam user <myemail> add drivefileacl 1lntEJ************************1p5VZGc user <new....@email.com> role owner
then I tried 
gam user <myemail> add drivefileacl 1lntEJ************************1p5VZGc user <new....@email.com> role writer

Ian Bevan

unread,
Apr 23, 2021, 7:18:33 AM4/23/21
to GAM for Google Workspace
I think I've got to the bottom of it.
shareUserRateLimitExceeded means that some files were not shared, despite the fact that the folder is.

Ian Bevan

unread,
May 12, 2021, 11:10:09 AM5/12/21
to GAM for Google Workspace
A little update to this thread.


The issue I had was I needed to migrate/transfer nearly 7000 student's home folders to their MyDrive after we had been hit by Ransomeware and had no way for students to access them until we rebuilt most of what we had lost. Some of these folders were of work that had up to 7 years worth of data included.

After my previous update on the 23 April, Ross contacted me asking to send a meet invitation.
Whilst I sat at home connected via Meet with Ross, he talked me through what was required also explaining to me what was happening during each part of the process.
I had RCLONED these folders to MyDrive from a Network share, this process started on the 30th April and finished earlier this week. This meant that luckily the folders and documents were relativley clean from a permissions point of view.

Ross was online with me for around an hour whilst we waited for the first transfer to complete. Thanks to Brian's help earlier, I had a gsheet with the folder id and the folder name which was the same as the username portion of the email address, so a quick concatenate filled in the rest and I had the data needed to continue.

The command that was run was:
gam user ian.bevan transfer drive <foldername> select <folder id> targetfolderid root targetuserfoldername "" mergewithtarget retainrole none preview

Today, just about 10 minutes ago, the task finally completed and I would like to thank Ross for his help.
If Ross says, send me an invite, do it. Ross is not only super helpful with the problem at hand, but as he talks his way through it, you learn as well.

Ross, I am most grateful for your support which has helped our students in turn also.



Kim Nilsson

unread,
May 14, 2021, 7:41:00 AM5/14/21
to GAM for Google Workspace
Also, thank you, Ian, for following up in the thread.
Means that future users can find how you solved your problem.
Reply all
Reply to author
Forward
0 new messages