Renaming a file is easy, but when you have dozens or hundreds of files to rename, the task can be overwhelming. Fortunately, there’s a tool (or toy) for that!
PowerRename, part of PowerToys, is the utility for renaming files – of any quantity – in just a few steps. What makes it especially fun is the capability unlocked by using Regular Expression to rename your files.
For demonstration, here’s a scenario:
You want a standardized naming convention for client intake forms. Until now, the documents have been named ‘Client Intake Form – Client Name.’ You’d like to have the client’s name listed in front of Client Intake Form.
First, you’ll want to install PowerToys.
Next, locate the folder with the files you want to re-name and right click to open the context menu. Select ‘Power Rename’
We’ll take this process in two steps. First, we trim ‘Client Intake Form –‘from the beginning of the file name, then we’ll append it to the end of the file name.
I borrowed regular expressions to complete these steps from Microsoft’s PowerRename documentation.
Step 1 - Trim ‘Client Intake Form -’ from the beginning of the file name
In the ‘Search for’ field enter the regular expression to trim characters from the beginning of the file name. Select ‘Use Regular Expression’ In this expression, n=the number of characters to trim
Regular Expression: ^.{n}
In this case, nothing is being replaces, so don’t input anything into the ‘Replace with’ field.
Once you’ve set up your search and replace fields, you can preview the renamed file in the ‘renamed’ column.
Click Apply
Step 2 - Append ‘- Client Intake Form’ to the end of the file name
With the prepending characters removed, we have files with just the client's name, and we can append the rest of the file name.
In the ‘Search for’ field, we use the regular expression to search for any file with the .docx extension.
Regular Expression: (.*).docx
In the ‘Replace with’ field, enter the expression to append a string to the exiting file name.
Regular Expression: $ - Client Intake Form.docx
Confirm the files will be renamed correctly by checking the ‘renamed’ column’
Click ‘Apply