PowerShell Saves the Day! – Change File Extension for over 10 Thousand Documents
August 10, 2008 § 1 Comment
A Hard Drive failure almost managed to destroy IMPORTANT DATA from a LAB Company in located in Puerto Rico USA. In a recovery process a Disaster Recovery Tool used to import the DATA to a safe HD renamed the EXTENSION of over 10 Thousand files.
Edited changed the Start In Path of PowerShell to the same location where the "change extension" files reside to avoid real move of the file and just change extension operation to happen.
1. Create a Shortcut on the Desktop for PShell.
2. Go to the Properties of the PShell Shortcut.
3. Change the location of the ‘Start In" of the shortcut you have created and place the exact location of the files which need file extension changed.
4. Ran the command provided by Lee (MSFT) and Marco (MVP).
Command:
dir *.bad-ext | Move-Item -Destination { [IO.Path]::ChangeExtension( $_.Name, "good-ext" ) } -WhatIf
Thanks to Lee (MSFT) and Marco (MVP)!
Isvet Laclaustra
As I get it while trying, one should remove the -whatIf if he wants to change the extension actually. With -WhatIf option, it just tells you what is going to happen; not actually changing the extension.