Batch Increment file names with PowerShell

Nowadays I’m writing a book related to Windows Server 2012 in Turkish. My publisher asked me to rename all jpeg file names to incremented file names as follows:

imagexx.jpg to IMAGE-1.JPG

imageyy.jpg to IMAGE-2.JPG

imagezz.jpg to IMAGE-3.JPG

It is pretty easy with powershell,

Dir *.jpg | ForEach-Object  -begin { $count=1 }  -process { rename-item $_ -NewName “IMAGE-.$count.jpg”; $count++ }

You can start with count number 1 or any number you want. I hope my second book will be realeted to PowerShell 🙂