Rename files to increment filenumber using PowerShell?
Posted
by
Frode Lillerud
on Stack Overflow
See other posts from Stack Overflow
or by Frode Lillerud
Published on 2011-01-16T15:06:14Z
Indexed on
2011/01/16
17:53 UTC
Read the original article
Hit count: 231
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.
© Stack Overflow or respective owner