I currently have a directory with several thousand files in it.
Each file has _c04_
or _c05_
etc. somewhere within the filename.
I need to rename all of these files to _c004_
or _c005_
etc.
The only thing that needs to change, is adding the extra zero.
The letter will always be c
.
I'm very new to regex, and I don't know the correct method for searching and replacing this string of characters.
I've written this code so far, but obviously this isn't scalable ...
(since it only modifies 04 rather than 01-99)
dir | rename-item -NewName {$_.name -replace "_c04_","_c004_"}