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