Batch Renaming File Extensions

Batch Renaming File Extensions

A tiny snippet of code I hardly ever need, until I desperately need it and find I've forgotten how Get-ChildItem works:)


Get-ChildItem $MyPath\* -Include *.htm |
Rename-Item -NewName {$_.Name -replace '.htm','.md'} -PassThru

Most recently I needed to batch change several hundred .html files as .markdown and didn't fancy doing that by hand.