How to Bulk Rename ‘Copy of’ Files in Google Drive
If your Google Drive happens to be cluttered with countless files prefixed with “Copy of”, know that I feel you…
Not only does it make your drive look messy, but it also hampers your productivity by making file searches more complicated than necessary. But no worries, I’m going to walk you through a simple yet powerful way to rename these files in bulk, making your digital life a bit easier.
The Importance of a Clean Drive
I know removing redundant prefixes like “Copy of” can seem trivial but it is a step towards digital decluttering, which can significantly impact your work or study flow, a well-organized Google Drive is akin to a tidy workspace:
It boosts your efficiency,
Saves your time,
Reduces your stress.
Step 1: Prep Your Google Drive
First things first, create a new folder in your Google Drive and name it “A” (or any name you prefer, but remember it for the script part). This folder will be the temporary home for all the files you wish to rename.
Step 2: Code the Script
Next up, let’s code the script that will do the heavy lifting for you. Here’s how:
Open Google Docs or Sheets, head to “Extensions”, and select “Apps Scripts” to create a new script.
Copy and paste the script provided below into the script window:
function fileRename() { var folders = DriveApp.getFoldersByName('A'); var folder = folders.next(); var files = folder.getFiles(); while(files.hasNext()){ var file = files.next(); var fileName = file.getName(); if (fileName.indexOf('Copy of ') > -1) { fileName = fileName.split('Copy of ')[1]; file.setName(fileName); } } }
Rename the Script
Save
This script scans through every file in the “A” folder, looking for ones that start with “Copy of”. For each of these files, it removes the “Copy of” prefix, leaving you with the original file name.
Step 3: Run Your Script
After pasting the script, it’s showtime! Return to your Google Drive, make sure all files you want to rename are in the “A” folder, and then run your script from the Script Editor by clicking the “Run” button.
Voilà! All your files will shed their “Copy of” prefix like magic.
Wrapping Up
And there you have it — a neat Google Drive free of the “Copy of” prefixes!
I hope this guide helps you tidy up your digital workspace and makes your life a little easier.
If you’ve found this post helpful or have any of your tips and tricks for Google Drive organization, feel free to share them in the comments below.