another problem copying folder tree with multiple parents

260 views
Skip to first unread message

Brian Gray

unread,
Jul 28, 2021, 5:53:00 PM7/28/21
to GAM for Google Workspace
I am trying to copy a Drive folder tree, but I am running into problems with multiple parents of some of the sub-folders.  I have looked at the "multiple parents" section of the wiki, but I don't really understand what the options (copytopfileparents, copytopfolderparents, copysubfileparents, copysubfolderparents) mean or which ones I should use.

The top-level source folder ("English") was owned by teacher2 and is now owned by teacher1.  The folder structure is several levels deep. The sub-folders are each owned by one of several teachers (teacher1, teacher2, and others). Some of the folders and files have multiple parents. I want the destination folder ("English-copy") to be in the owner's MyDrive.

The command I have been working with is:

gam user teacher1 copy drivefile id 0B6Sxxx3TkE newfilename English-copy recursive duplicatefiles skip copytopfileparents all copytopfolderparents all

After copying many files, GAM stops with this error:
ERROR: 403: cannotAddParent - Increasing the number of parents is not allowed

The folder that contains the last files that were copied also contains folders owned by teacher2, and some of the folders probably have multiple parents.

What is the correct incantation to copy all of the files and folders?

GAMADV-XTD3 6.06.09 - https://github.com/taers232c/GAMADV-XTD3 - pyinstaller
Python 3.9.6 64-bit final
google-api-python-client 2.10.0
httplib2 0.19.0
Windows 10 10.0.19042 SP0 Multiprocessor Free AMD64

Ross Scroggs

unread,
Jul 28, 2021, 6:37:16 PM7/28/21
to google-ap...@googlegroups.com
Brian,

Contact me directly so we can discuss..

Ross

--
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 on the web visit https://groups.google.com/d/msgid/google-apps-manager/59e31665-88ec-4faf-af85-34108788deb5n%40googlegroups.com.


--

Brian Gray

unread,
Jul 28, 2021, 10:00:41 PM7/28/21
to Google Apps Manager

Ross - 

The copy operation completed at 8:15 pm.  The only failures were two Google Sites files.

I ran "print filetree" commands to verify that the source and destination match.  They did.

Thanks for your help this evening.  I appreciate it.

bkg




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/2LOlw35fYLE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apps-man...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/CAJkvRS_Ag6eC%2BU1%3Dw-yvKJrcZjPPRfXT7B-HqbnQDZp1ySG1Ew%40mail.gmail.com.


--

Brian Gray

unread,
Jul 29, 2021, 2:10:00 PM7/29/21
to GAM for Google Workspace

The final version of the command that worked for my purpose is:

gam redirect stdout log.txt redirect stderr stdout user teacher1 copy drivefile id 0BabcdTkE newfilename Target-Folder-Name recursive duplicatefiles overwriteolder duplicatefolders merge copysubfolderparents none copysubfileparents none copytopfileparents none copytopfolderparents none 

Some of the files and folders in the source folder tree had multiple parents (i.e., appeared in multiple folders) dating back to when that was permitted. The trick to making it work was specifying that no additional parents of a file or folder should be included in to copy.

Brian Kim

unread,
Jul 29, 2021, 4:58:26 PM7/29/21
to GAM for Google Workspace
Thanks for sharing! Starring this so I can find this later.

Kim Nilsson

unread,
Aug 13, 2021, 9:52:11 AM8/13/21
to GAM for Google Workspace
@Brian Gray,
do you think this would be able to accomplish the same, but

1. as a move, and not copy.
2. as a move, where the destination is a Shared Drive, and not a regular folder?

Asking since someone else asked about that a while after this post, and nobody has an answer for it.

Brian Gray

unread,
Aug 13, 2021, 10:03:28 AM8/13/21
to GAM for Google Workspace

In my case, the goal was to create a copy side-by-side with the original folder tree (that is - both the original and the copy in a user's My Drive).

I have not done moves or copies to shared drives via GAM, so I don't know what it would do.

MattL

unread,
Jan 22, 2022, 12:09:54 AM1/22/22
to GAM for Google Workspace
Circling around back to this as I was hoping someone would have an answer as I'm being asked to move a folder directory that has files and folders with multiple parents into a Share Drive.

Kim Nilsson

unread,
Jan 22, 2022, 1:16:43 AM1/22/22
to Google Apps Manager
There's a beta out for exact move.
Meaning folderid will be retained. 

Currently you can move just fine, but folders will get new ids. 

MattL

unread,
Jan 22, 2022, 8:45:05 PM1/22/22
to GAM for Google Workspace
Thanks for responding Kim however we've noticed that if you move a duplicate folder into a share drive all the folders disappear which is the concern.

Kim Nilsson

unread,
Jan 23, 2022, 2:45:28 AM1/23/22
to Google Apps Manager
Well, you shouldn't have duplicates. 

MattL

unread,
Jan 23, 2022, 2:45:17 PM1/23/22
to GAM for Google Workspace
If you press shift + z on a folder you can create one though.

Kim Nilsson

unread,
Jan 23, 2022, 3:39:14 PM1/23/22
to Google Apps Manager
That's not a duplicate, though.
It's the exact same folder, symlinked into a different place.

Delete one and both will disappear.

A duplicate is a clone, a copy.

Shift-z was supposed to go away when they introduced Shortcuts, since files and folders weren't supposed to be allowed to have more than one parent anymore, and they removed the Add here-function in the Drive menu.

I just re-read your initial question and see that is exactly what you're asking about.
afaik, moving content with multiple parents is supposed to be better with the new beta, but can't actually ever work as before, as multiple parents isn't allowed anymore.

That the keyboard shortcut still works, and is even referenced to, is embarrassing to say the least. I loved it, back when it was a commonly used feature. And was sad when it was said to be deprecated. Now I'm even more sad to learn that they just hid it more.

/Kim

MattL

unread,
Jan 23, 2022, 3:41:27 PM1/23/22
to GAM for Google Workspace
Thanks Kim. Sorry for being unclear.

The long term issue is that some people have these clones (shortcuts) in their own drive structure and will not know where to find the files after we move them to a share drive. I'm trying to find a way to at least identify those clones and at best convert them to shortcuts.

Kim Nilsson

unread,
Jan 23, 2022, 4:21:34 PM1/23/22
to Google Apps Manager
Yes, it is an issue that I know Ross & Jay is aware of.
And Google is working on it.
Some type of de-duplication is supposed to be done.
I don't know the time-line.
Reply all
Reply to author
Forward
0 new messages