recursively rename files and folders based on pattern

236 views
Skip to first unread message

Jesse Noyes

unread,
Feb 18, 2022, 7:00:58 PM2/18/22
to GAM for Google Workspace
Hello all,

I am hoping there is a quick way to do this that you can all help me out with. We have a particular folder on a drive that is used as a type of template for new customer information. When a new customer is onboarded, the folder/file hierarchy is copied to a folder like so:

gam user USERNAME copy drivefile id FILEID parentid PARENTID copyfilepermissions false newfilename "NEW CUSTOMER NAME" recursive copytopfoldernoninheritedpermissions never copymergewithparentfolderpermissions false copymergedsubfolderpermissions false copyfileinheritedpermissions false copyfilenoninheritedpermissions false

The top folder has a couple of dozen directories under it, and quite a few files scattered throughout. Once that is created, currently the project manager has to go through and manually rename folders and files to the new customer's name instead of just "customer"

How can I do an update within a folder that will replace the word "customer/CUSTOMER/Customer" with the "New Customer Name" on any matching folders/files? Can this be done with a simple update command with some regex?

Using GAMADV-XTD3 

Thanks a ton in advance for any help you can give me!

Ross Scroggs

unread,
Feb 18, 2022, 9:21:17 PM2/18/22
to google-ap...@googlegroups.com
Jesse,

Are the files to be renamed simply "customer/CUSTOMER/Customer" or can "customer/CUSTOMER/Customer" be embedded in the filename?

--
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/4e606acf-32dd-4c2f-b6f6-8a26f6e50bf1n%40googlegroups.com.

Kevin S

unread,
Feb 21, 2022, 4:35:22 AM2/21/22
to GAM for Google Workspace
Hello Ross,

Good day! Would it be possible to rename HTML files in Google MyDrive/Shared Drive. The title of the file contains the "ID" of the Shared Drive and looking to renaming it to name of the "Shared Drive", have stored ID - Shared Drive Name in a CSV file.

Thanks, Kevin

Jesse Noyes

unread,
Feb 22, 2022, 12:56:27 PM2/22/22
to GAM for Google Workspace
Oh good question - it is embedded in the file/folder name. E.G. Folder "CUSTOMER Project" containing files "Customer - Budget Overview.doc" and "customer contact listing.xlsx" 

Ross Scroggs

unread,
Feb 22, 2022, 1:16:02 PM2/22/22
to google-ap...@googlegroups.com
Jesse,

Contact me directly via Meet/Zoom.

Ross



--

Ross Scroggs

unread,
Feb 22, 2022, 6:33:49 PM2/22/22
to google-ap...@googlegroups.com
Jesse,

This can now be done with GAMADV-XTDS 6.15.23


gam user USERNAME copy drivefile id FILEID parentid PARENTID copyfilepermissions false newfilename "NEW CUSTOMER NAME" recursive copytopfoldernoninheritedpermissions never copymergewithparentfolderpermissions false copymergedsubfolderpermissions false copyfileinheritedpermissions false copyfilenoninheritedpermissions false replacefilename customer "New Customer Name"

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/4e606acf-32dd-4c2f-b6f6-8a26f6e50bf1n%40googlegroups.com.


--

Jesse Noyes

unread,
Feb 23, 2022, 11:10:28 AM2/23/22
to GAM for Google Workspace
You are awesome! I will give this a try here shortly. Let me know if you still want to do a meet or chat - I'm in and out all day today so we could find a time.

Ross Scroggs

unread,
Feb 23, 2022, 11:15:00 AM2/23/22
to google-ap...@googlegroups.com
Jesse,

Test it out, send me a message if you'd like to meet.

Ross



--
Reply all
Reply to author
Forward
0 new messages