Rename files to increment filenumber using PowerShell?
- by Frode Lillerud
Hi,
I've got a bunch of files named
attachment.023940
attachment.024039
attachment.024041
attachment.024103
etc...
I need to rename the files by incrementing the filenumber by a given number. (So that they match the right ID in a database)
I guess I could write a C# application that uses RegEx to parse the filename, but I assume this is a task that could be accomplished in PowerShell as well?
I've found several other threads on SO about using PowerShell to rename files, but none of them handled incrementing a filenumber.
I'm on Win7, so PowerShell 2.0 is available.