Batch replace file extension of all files in a folder

From time to time, I need to quickly change the file extension of all files in a folder. While there are tools that can do that for you (one of which I’ve written about previously), if you need to append the same file extension to all files in a folder, using the command line in Windows can be just as quick. Here’s how:

  1. Open a command line window
  2. Navigate to the folder where the files are located
  3. Enter the following command: rename *.* *.EXTENSION (replacing EXTENSION with the desired extension):

Beware; this is a very powerful tool, and used as shown above, it will append the new file extension to all files in the folder. For those occasions where that’s what you want, though, it’s pretty useful.

In case you’re wondering why I’d need to do this, in the example that inspired this post, I had a support ticket where a user had sent me a large amount of emails as attachments to an email, which arrived with a number of file extensions, including .bin and .do. I needed to change them to .eml to open them in Outlook.


Posted

in

by

Comments

By posting a comment, you consent to our collecting the information you enter. See privacy policy for more information.

This site uses Akismet to reduce spam. Learn how your comment data is processed.