Powershell: How to rename all files in a folder

Powershell Header

Sometimes you need a fast way to rename a lot of file. With Powershell this is pretty easy. You list all files in the directory and you can use this object with a foreach loop.

This script basically changes the extension from .JPEG to .jpg:

$files = Get-Content
foreach ($file in $files) {
$newFileName=$file.name.replace(".JPEG",".jpg")
Rename-Item $file $newFileName
}