Skip to content

Instantly share code, notes, and snippets.

@PietrH
Created July 8, 2019 09:59
Show Gist options
  • Save PietrH/ead6307fa2442c894eb2859ee31069ff to your computer and use it in GitHub Desktop.
Save PietrH/ead6307fa2442c894eb2859ee31069ff to your computer and use it in GitHub Desktop.
Bulk change the extension of files in a folder in Powershell
Get-ChildItem -Path C:\Demo -Filter *.txt | Rename-Item -NewName {[System.IO.Path]::ChangeExtension($_.Name, ".old")}
@PietrH
Copy link
Author

PietrH commented Jul 8, 2019

An example to change all txt files in the current folder to jpg files with the same filename

Get-ChildItem *txt | Rename-Item -NewName {[System.IO.Path]::ChangeExtension($_.Name,".jpg")}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment