Remove Numeric Characters from file names using Powershell
For work I had generated over 500 files in a folder that needed to have their names changed.
I figured going through them one at a time and renaming them was going to take up a lot of my time.
So here’s shortcut to the SOLUTION.
If you’re using Windows 8 follow these steps:
1. Type in PowerShell in the start menu
2. Use the cd command to navigate to your directory: Example: cd Desktop/FolderToRenameFiles
3. Type in ls to view the contents of the directory. Like this:
4. to replace the numbers with any sort of text just paste this in there:
Dir | Rename-Item -NewName { $_.name -replace “[0-9]”,”_” }
The line of script, above, will take the numbers out and replace them with with an underscore ‘_’ symbol.
5. type in ls and see the result.
6. Now we’re going to take those underscore symbols out and replace them with whatever we want. For this example I will replace them with this word: ‘Composer‘
Here’s the script for that:
Dir | Rename-Item -NewName { $_.name -replace “____”,”Composer” }
and hit Enter:
7. Type in ls and see the final result.
You’re done!