Rename file extension with PowerShell
Last week I ended up finding that one of my directories of pictures lost their file extensions – so I thought I’d spin up PowerShell in Win8 and see if I could remember how to do.
After a little trial and error I ended up with the following PowerShell Script – reminded me how powerful and easy PowerShell is for scripting all of Windows.
- $proj_files = Get-ChildItem | Where-Object {$_.Extension -ne ".jpg"}
- ForEach ($file in $proj_files) {
- $filenew = $file.Name + ".jpg"
- Rename-Item $file $filenew
- }
Cross Posted from Dan Fay's Blog (https://blogs.msdn.com/dan\_fay)