Move files inside share drive while preserving permissions

29 views
Skip to first unread message

Matthew Weiner

unread,
Sep 3, 2025, 10:16:36 AM (2 days ago) Sep 3
to GAM for Google Workspace
I have a folder with a lot of files, like 16,000 files, that I need to move one level up in a share drive.  I had to restore them and my backup program put them in \folder\restored and I need them up in \folder - I figured I could just go into Drive on the web and ctrl+a but that'd only give me fifty at a time.

I feel like I'm missing an obvious command, but since share drives are a bit of a special case I'm not sure exactly what to do and since a lot of these files are shared outside the drive I need to preserve the permissions that are set on the files. I don't want to just wing it and guess, then spend the next three months fixing permissions on files if I guess wrong.

Ross Scroggs

unread,
Sep 3, 2025, 10:27:29 AM (2 days ago) Sep 3
to google-ap...@googlegroups.com
On Sep 3, 2025, at 7:16 AM, Matthew Weiner <mlwe...@lakelandschools.org> wrote:

I have a folder with a lot of files, like 16,000 files, that I need to move one level up in a share drive.  I had to restore them and my backup program put them in \folder\restored and I need them up in \folder - I figured I could just go into Drive on the web and ctrl+a but that'd only give me fifty at a time.

I feel like I'm missing an obvious command, but since share drives are a bit of a special case I'm not sure exactly what to do and since a lot of these files are shared outside the drive I need to preserve the permissions that are set on the files. I don't want to just wing it and guess, then spend the next three months fixing permissions on files if I guess wrong.


--
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/a83ebdc4-d2da-4dcf-9eba-6a5f6b354743n%40googlegroups.com.

Ross Scroggs

unread,
Sep 3, 2025, 10:52:19 AM (2 days ago) Sep 3
to google-ap...@googlegroups.com

Get the top level files/folders in \folders\restored

gam redirect csv ./TopFilesFolders.csv user sdorg...@domain.com print filelist select <\folders\restored ID> fields id,name,mimetype depth 0


Inspect TopFilesFolders.csv


Move the top level files/folders up one level

gam redirect stdout ./MoveTopFilesFolders.txt multiprocess redirect stderr stdout csv TopFilesFolders.csv gam user sdorg...@domain.com update drivefile "~id" parentid <\folders ID>


Ross

----
Ross Scroggs


Matthew Weiner

unread,
Sep 3, 2025, 10:54:51 AM (2 days ago) Sep 3
to GAM for Google Workspace
Ah okay, it's a two step process, and all I need is the folder ID inside the shared drive.  I was overthinking it a lot trying to figure out how I specify the shared drive and then specify the folder like the move from user drive to shared drive commands work.

Matthew Weiner

unread,
Sep 3, 2025, 11:28:56 AM (2 days ago) Sep 3
to GAM for Google Workspace
That's working perfectly.  Got a ways to go, because it's 16,000 files, but I can leave it to do its thing.  Definitely overthinking it, I keep thinking shared drives are these special things that need their own separate set of commands and all the usual IDs and stuff wouldn't work.  Thanks for helping me out again, Ross, you're a life saver!

On Wednesday, September 3, 2025 at 10:52:19 AM UTC-4 Ross Scroggs wrote:

Ross Scroggs

unread,
Sep 3, 2025, 11:31:11 AM (2 days ago) Sep 3
to google-ap...@googlegroups.com
Do you mean that it's 16,000 files directly in \folders\restored?

Ross
----
Ross Scroggs


Matthew Weiner

unread,
Sep 3, 2025, 11:34:21 AM (2 days ago) Sep 3
to GAM for Google Workspace
Yup, 15,516 to be precise.  File management is not a fine art here.  It's at 900.  I figure I'll have to do an API backoff a few times through this process.

Ross Scroggs

unread,
Sep 3, 2025, 11:36:53 AM (2 days ago) Sep 3
to google-ap...@googlegroups.com
Time to introduce them to sub-folders.

Ross
----
Ross Scroggs


Matthew Weiner

unread,
Sep 3, 2025, 11:38:23 AM (2 days ago) Sep 3
to GAM for Google Workspace
Would you believe there's another 13,000 files in subfolders on top of that?  I want to introduce them to the delete key.
Reply all
Reply to author
Forward
0 new messages