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

About these ads

§ One Response to PowerShell Saves the Day! – Change File Extension for over 10 Thousand Documents

  • beytan says:

    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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

What’s this?

You are currently reading PowerShell Saves the Day! – Change File Extension for over 10 Thousand Documents at Isvet_JR.

meta

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: