GAM moving specific files from my drive to share drive for former employees

271 views
Skip to first unread message

Ed Lawless

unread,
Mar 5, 2025, 11:46:39 AM3/5/25
to GAM for Google Workspace
Hello all, 

I have a bit of an interesting project I am trying to figure out how to tackle.  I have seen a few other posts on how to move a users my drive in bulk to a shared drives.  But I have a bit of a different situation.  

We are trying to take steps to clean up the amount of suspended accounts in our org and it has come to our attention that some of these files need to be transferred to either active employees or share drives; because these folks have left.  

We have a World Language Program that was setup by a department within our school district and they had foreign language teachers write all these documents to contribute to this program.  However, the files were shared via the my drive and the ownership was not parked in a shared teams drive.  

Some of these folks may have contributed multiple files; but we only want to grab specific documents that was originally shared with the department program coordinator.  Most of the folks that wrote a lot of these documents have since moved on and they are no longer part of our district.  

My thought is to setup a new Teams Share Drive specific for this program; but I am struggling with syntax on how to build my GAM statements.  We want to retain the doc IDs and document history; its also important that we don't orphan people from the documents that currently have access.  

The program coordinator is currently building me a list of the documents which could be 500 or more individual files; they are all owned by different users.  She is going to provide me with specific links; so getting the document IDs should not be an issue.  These docs should also be parked inside our workspace org.  

At this time I believe they have kept up with all these resources with a master document; I need to have another conversation with the current manager.  

So if we know the doc ID, former employee logon and what share drive we want it to go into.  Do we need to worry about duplicate titles, if the files all have unique docIDs? 

I am thinking to just build a big CSV to kick off the transfer to the new parent share drive.  But I could use a little help with syntax.

Does anyone have any insight into how we proceed? 

Thanks, 
Ed



Email correspondence to and from this address is subject to public records requests pursuant to the North Carolina Public Records Law, resulting in monitoring and potential disclosure of this message to third parties.

In compliance with federal law, Charlotte-Mecklenburg Schools administers all education programs, employment activities and admissions without discrimination against any person on the basis of gender, race, color, religion, national origin, age or disability.

Ross Scroggs

unread,
Mar 5, 2025, 11:48:42 AM3/5/25
to google-ap...@googlegroups.com
Ed,

Send me a private Meet/Zoom invitation and we'll work on a solution.

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/289936cb-85c1-40a4-9ebc-4a58f351100an%40googlegroups.com.

Ed Lawless

unread,
Mar 14, 2025, 3:46:28 PM3/14/25
to GAM for Google Workspace
Good afternoon all, 

I wanted to follow up with the group and give others and update that might be attempting to do a similar project.  Ross was very gracious in allowing me to walk him through the requirements of our World Language program data transfer.  The curator of this program had everything on her my drive broken out into sub folders and all very well organized but the problem was 50& or more of these files she did not have ownership permission on.  We were also concerned about flattening the folder structure out.  We were able to formulate the following GAM command that worked really nicely and I will share my breakdown on the syntax; but first the syntax: 

gam redirect stdout .\movefilestosd.txt redirect stderr stdout user <super account used with gam> move drivefile <mydrive docID> teamdriveparentid <Team Drive ID>  mergewithparent duplicatefolders duplicatename duplicatefiles duplicatename copysubfolderpermissions false retainsourcefolders

Ok so here is the break down of these various switches: 
gam redirect stdout .\movefilestosd.txt redirect stderr stdout  - This allowed us to capture all logging and console information that would have normally came to the screen; all in one file.  If you get rid of the .\ in front of movefilestosd.txt.  this text file would reside in your GAM work folder.  I prefer it to live with where I have my scripts created so that is why I do it that way.  Feel free to experiment.  

user <super account used with gam> move drivefile <mydrive docID> teamdriveparentid <Team Drive ID>  - next we need to define the user account and the action (move in this case) then comes the paths to the source and target locations.  The user account should have at least edit access to source folders and sub folders on the users my drive that we are getting ready to be move.  For the teams drive I would recommend making sure this same user account has manager access.  

mergewithparent - This copied over everything in the my drive folder and the subs but not the top folders name since for us we wanted to do away with that name; since it would have been redundant.  Since The Teams drive was named something similar already.  

duplicatefolders duplicatename duplicatefiles duplicatename - We specified this so that if we had more than one file or folder with the same name they would not overwrite each other and would co-exist together.  If you were to run the same command twice with this specified its possible to create additional duplicate folders if you also have specified retainsourcefolders.   Be aware.

copysubfolderpermissions false - I did not want to copy subfolder permissions because I wanted that to be controlled from the root of the share; since this particular structure was not initially setup by IT staff.  To avoid issues with broken inheritance.  

retainsourcefolders - this leaves a skeleton of folders still out on the original source location after the move is complete.  In our case this was on a user's my drive.  

I hope this helps others.  This helped us retain the original structure and make the organization the owner; it worked perfect.  They had a little over 3000 files and folders that we were dealing with.  Out of that there were 160 files that the department will have to deal with that were created using personal gmail accounts.  I furnished them a list because they will have to make copies and update links in the master documents to reflect these changes.  This worked very slick.  

A big Thank You to Ross!! 

Take care, 
Ed
Reply all
Reply to author
Forward
0 new messages