Google Apps Script, DriveApp
I had an unexpected need to change some non-native file names – in my case, MS Word docs – to something else to appease my masters. Being the resident Igor, I delighted in the task.
The Problem
I had a folder of MS Word documents on my Google Drive that needed to all be renamed. They all needed the same name with an index number to distinguish that they were different files.
There were however other file types in the folder.
The problem with non-native files in Google Drive is that it’s a little tricky to find their ID. Besides, I just wanted to change ALL files that were MS Word in the folder.
What I would need to do is search for all files inside my selected folder that are of MS Word type and rename them with the same name but with a counter at the end. For example:
Old File Name | New File Name |
boring.doc | cranberrySauce.doc |
sad.doc | cranberrySauce1.doc |
yawn.doc | cranberrySauce2.doc |