How to batch change file extensions for Windows files

Posted on February 28, 2008 at 7:07 am

Recently, I came across a problem where I had to change the file extension on a bunch of Windows files from no extension to .JPG. Someone sent me a large number of files, but for some strange reason, they had no file extension, even though they were images! Once I added the .JPG extension to the end of the file, I was able to open the images.

There are many other reasons why you may need to rename file extensions, so I’ll show you how you can change them one at a time if you have a small number of files or batch rename file extensions if you have lots of files.

If you’ve gotten an email with an attachment with no file extension, the file may look like this and when you try to open it, may ask you to choose from a list of programs:

file extensions

Obviously, since there is no file extension for the file, Windows is not able to determine which program should open it. If you want to change the file extension for the file, you first need to be able to see file extensions in Windows. You can do this by going to My Computer and then going to Tools and  Folder Options.

tool folder options

Go to the View tab and scroll down till you see the option “Hide extensions for known file types“. Go ahead and uncheck it.

hide know file types

If the file has no extension at all, this step may not be necessary, but I am including it because if you’re trying to CHANGE the file type from one type to another, then you need to do this. Now right-click on your file and choose Rename.

reanme files

Move to the end of the name and type in .XXX or whatever the type is for the file you want it to be, i.e. .TXT for text files, .XLS for Excel files, etc. Obviously, the file has to have originally been from that program that you are changing the file extension too. In my case, the text file was from Excel and I removed the file extension, now I’ll add it back.

rename file

How to batch rename file extensions

So how do you rename multiple file extensions at once? If you have a directory full of files that need to be changed from .PNG to .JPG, it’s going to take forever to do this using the method above. That’s where you need a freeware application that can batch change file extensions for you.

Extension Renamer is a simple to use, freeware program that I have tested and contains no spyware, etc. Once you install it, it’s a piece of cake to change file extensions!

file extension changer

First, click Select Directory and choose the directory that contains all of the files that you want to modify. You have the option of including subdirectories also. Then you search for files with particular file extensions that you want to change. The *.* means that it will change ALL files to the new extension.

You can type in your the extension you want to change, such as .TXT in the From box along with an asterisk (*) or question mark (?) to help filter down the files. Click Search and the files that will be changed show up in the left box. Once you are satisfied, go ahead and click GO! Now all of your files will have their extensions renamed.

And that’s it! Any questions, post a comment! Enjoy!

[tag]changing file extensions, change file extension, rename file extensions, batch rename file extensions, mass rename file extensions[/tags]

» Filed Under Computer Tips

Related Posts

Comments

59 Responses to “How to batch change file extensions for Windows files”

  1. Danny V said on :

    I try to use it but when I click GO, I get a runtime error. That’s a shame, it could be a really good tool.


  2. akishore said on :

    Danny, what runtime error do you get with the program? Also, what OS version are you running?

    Thanks


  3. tsberry said on :

    There’s an easier way (in Vista):

    Shift-right-click in the folder containing the files to be renamed

    Click on “Open Command Window Here”

    In the Command Window, type the DOS command for file renaming, as applicable: ie: ren *.jpg (to set the extension for all files in that directory to “jpg”)


  4. Michael said on :

    found your site today and downloaded the program.
    Works GREAT with some limitations
    at least in my aapplication)
    We had to change 5879 files from a printmaster “let” xtension to a “sig” xtension
    it would only do 39-43 changes at a time,and in the “from” box…once it would change the number of extensions that it did…you would have to change back the origional extension that you were trying to change… ctrl+v is good. Furthermore lets say someone wrote the file name as:
    j comelately.let (printmaster file) it would confuse the renamer and it would rename it:
    j.let (I’m assuming because of the space between the
    j and “comelately”.
    Further if there is to many periods at the end of the name (ie)jcomelately dr…let (“dr” as an abbreviation for drive then more than one period) it would have difficulties.
    in a perfect scenerio i think this is a wonderful program.
    M


  5. Jerry said on :

    Hi! to all expert!

    I have question in renaming files i.e. word or excel.

    I usually do like this “right click” the mouse and choose rename… and then type a new file name without adding the extension file i.e. “.doc” for word and “.xls” for excel. And yet, everytime I rename a file I am prompted error such as “IF YOU CHANGE A FILE NAME EXTENSION THE FILE MAY BECOME UNUSABLE. ARE YOU SURE YOU WANT TO CHANGE IT?” Yes or No!

    I opted YES! then it changed different icon on my file(unrecognized icon) and certainly unusable as I could not open the file and says CORRUPT! when I rename it adding the extension file it works! i.e. the new file name in excel is Monthly Report so I have to type Monthly Report.xls – it works this way. BUT previously you don’t need to add the extension file and it will autoadd/fill when you save the file.

    Does anyone has an idea? I am using Windows XP Professional (OS), and MsOffice 2003. The same problem with my PC at home with O.S. Windows Vista Ultimate and 2003 MSoffice.

    Any advise is very appreciated.

    Jerry


  6. Justin said on :

    I have a question. I need to change a video file from my phone (which has the extension 3GP) into a different extension so that I may edit the video file(s).

    I have tried a fair few times with the method given, although every time I do the file becomes corrupt or invalid. I have tried a few different types of movie file extensions (such as .avi or .mp2) and none of them seem to work.

    Any explanation as to why this is happening, or a different way i can change the file(s) to a different movie extension would be greatly appreciated.

    E-mail me at poli910@hotmail.co.uk if possible, as I may not check here.

    Thank you,

    Justin H.

    P.S. Good route given here for showing how to change file extensions!


  7. aaronmeister said on :

    WOW! Works like a charm – Much easier and user friendly than using the Command Prompt – I changed the extension on over 400 video files in less than three minutes. Thanks for the heads up!


  8. expert said on :

    if you have winxp or win vista, just open a command window,
    enter into your directory and type

    ren *.dat *.mpg

    this will change all files with extension .dat to .mpg.
    super easy!


  9. Si3Si3 said on :

    PS

    if you have a folder with different file of types (eg jpg/bmp/gif/ico/tga) and want to change ALL files to One type (eg png) then type:

    ren *.* *.png

    NB – All files in folder WILL change to .png!!


  10. Fath said on :

    hi Jerry
    you have to hide the file extensions, to do so:
    open any folder, go to “Tools”, select “Folder options”
    find the option “Show extension for known file types”, this one must be ticked in your computer, un-check it and you should get only the names of the files without the extension.


  11. Dawn said on :

    Hey! Thanks for the help!

    But I have a problem here… There isn’t any option as “Folder Options” in the Tools Menu. The menu just shows three options, Map Network Drives, disconnect them, and synchronize. Why isn’t the fourth option visible?


  12. djz said on :

    Here is a statement you can use in a command prompt to accomplish the same thing. Be sure to test it first.

    for /f %x IN (‘dir /b’) DO ren %x %x.new

    Use FOR /? to see the complete documentation on the command. There is a slight difference for batch file usage.


  13. djz said on :

    Note that my previous suggestion just adds a file extension, it will not change an existing extension.


  14. Goodguy said on :

    tsberry, thanks for the Vista tip!


  15. NR said on :

    Sir, Thank you for the batch rename information. Like yourself, I would like to rename pic files that have no extension. I don’t understand how this can be accomplished with the Renamer utility. Seems as though I need an extension to begin with. Can you help?

    Thanks
    NR
    Washington DC


  16. dave seeley said on :

    I love you, man. thanks a million…files that is.


  17. azhar said on :

    Hi! to all expert!

    I have question in renaming files i.e. word or excel.

    I usually do like this “right click” the mouse and choose rename… and then type a new file name without adding the extension file i.e. “.doc” for word and “.xls” for excel. And yet, everytime I rename a file I am prompted error such as “IF YOU CHANGE A FILE NAME EXTENSION THE FILE MAY BECOME UNUSABLE. ARE YOU SURE YOU WANT TO CHANGE IT?” Yes or No!

    I opted YES! then it changed different icon on my file(unrecognized icon) and certainly unusable as I could not open the file and says CORRUPT! when I rename it adding the extension file it works! i.e. the new file name in excel is Monthly Report so I have to type Monthly Report.xls – it works this way. BUT previously you don’t need to add the extension file and it will autoadd/fill when you save the file.

    Does anyone has an idea? I am using Windows XP Professional (OS).

    Any advise is very appreciated
    azhar


  18. hdjunkie said on :

    How about run…cmd
    cd wherever
    rename *.new *.old?


  19. Patrick Mc said on :

    You can use biterscripting (http://www.biterscripting.com for free download) for batch renaming files, also batch copying, moving, editing, deleting, files.

    Patrick


  20. Joe said on :

    It’s been said in different ways from previous posters, but just to show another easy way on Vista to change multiple files that already have a file extension to a different file extension, do the following. As far as I know, this is the least amount of typing using command prompt to accomplish this task.

    1) Shift + Right Click in the folder containing the files who’s file extensions you wish to change.

    2) Inside the command prompt type “ren * *.(your file extension)”

    So to change my .jpg files to .PNG I did “ren * *.png”.

    …and presto, chango, all your file extensions now have been changed to the one you specified in the command prompt. To give credit where it’s due, I figured this out by fiddling with the code tsberry posted and adding the additional * before *.(your file extension).

    What a great solution! Saves me SO much time. I wish I had found this out years ago…


  21. Corey said on :

    I have created a Excel picture file with pics and text. I am trying to take this file and transfer it to a photo sharing jpg. I am unable to do this as the file won`t show when i search in the browse my system from the sharing site. I am sure the extension is the problem and won`t display it. I still don`t know how to make it work and get the format i need for it. What can i do?


  22. Toy Yoda said on :

    This is pretty cool. But what do you do if your files have number padding? I tried using Extension Renamer and it does not allow for this. For example, if your files are named like the following, the program treats the numbers like the extension, but it is not the extension.

    file.001
    file.002
    file.003
    file.004

    Everytime the program changes the file name into a jpeg it does this:

    file.jpg

    …as opposed to this:

    file.001.jpg

    Thus the program freezes. Does anyone have a workaround for this? It is especially frustrating if you have many images as part of an animation. The files need to be sequenced as above. But I often encounter a batchof images that have the number padding but not the extenion. What to do?

    TX,

    Toy Yoda


  23. badbob said on :

    Extension Rename works where commandline fails! Apps that generate thumbnail files for videos will create files like my_video.avi.jpg. I need it to be my_video.jpg.

    ren *.avi.jpg *.jpg

    does not work in this scenario but Extension Rename does. Cool!


  24. Sweatyarmpit said on :

    @ Toy Yoda

    Throw all the files that should be renamed in one folder. Shift+right click the folder and select “Open command window here”.

    Insert the following:

    ren *.0** *.jpg

    All files should be renamed correctly…


  25. harith said on :

    Thanks for the tips..you solved my problem…was worried because I had to change a lot of file extensions quickly!


  26. habeyhl said on :

    Thanks for the heads up on Extension Renamer. It’s a little particular about your file structure (i.e., all the files in the directory it’s working on need to be of the same extension for it to work) – but it did the job!

    Thanks,
    -habeyhl
    (follow me on Twitter @habeyhl)


  27. Anonymous said on :

    If all the files are of the same extension then you can do it via the command prompt as well. I recently wanted to change a large (read 500+) group of .rar’s to the .cbr (comicbook reader) file extension. I simply navigated to the directory via the cmd prompt and did ren *.rar *.cbr worked like a charm in less than 10 seconds. Hope this helps.


  28. C.J. said on :

    For everyone using this program, PLEASE remember that this program simply changes the extension. It does not replace the process of converting files, such as music and video files. Those are files in a different format altogether. Look for a converter for the respected files instead of trying to rename them. It won’t work.


  29. Scuba Steve said on :

    To fix a directory containing files needing an extension in Windows 7 it is similar to Vista. No files can be selected/highlighted while doing this.

    While holding Shift, right click in the directory containing the files, click on “Open command window here”. Type the following: “rename *. *.ext” Without the quotes and ext being the extension you want to use. This is assuming all files in the same directory need the same extension assigned.


  30. Darius said on :

    Thank you sir.

    Im in process of building a site and need to change all ext from html to php.

    Thx for this excellent article.

    Regards,
    D


  31. Hammad said on :

    Oh Thanx It really works! Changed thousands of file extensions in minutes…whew!


  32. mdes said on :

    Here is an excellent and free software to batch rename files :

    SIREN at scarabee-software.net/en/siren.html


  33. dal said on :

    hi!

    i have a question for you, what about if you have files with the extensions with a number, say for example:

    file.001
    file.002
    file.003

    and you wanna change them into rar with number.. like:

    file.r00
    file.r01
    file.r02

    how can you do that in cmd?


  34. Patrick Mc said on :

    I am not sure if dal’s question was answered. To rename file.001, file.002, etc. to file.r01, file.r02, etc., you can use the following commands.

    var str list, path, file
    var int index
    lf -n “file.*” > $list
    while ($list “”)
    do
    lex “1″ $list > $path ; stex -p “^/^l[” $path > $file
    system rename (“\”"+$path+”\”") (“\”file.r”+makestr(int($index))+”\”")
    set $index = $index + 1
    done

    This is in biterscripting ( http://www.biterscripting.com ) . Don’t enter commands one by one. Easy way is to copy and save the entire script into file, say, C:/Scripts/IndexFiles.txt, then enter the following one single command.

    script “C:/Scripts/IndexFiles.txt”


  35. Teresa said on :

    All the files I needed to rename had the same extension – BAK. So I copied the files I needed to rename to c:\tempfile. Opened a command window. Changed directory to c:\tempfile

    RENAME *.BAK to *.DWG.

    Worked – easy.


  36. Browneye said on :

    Does anyone know of a way to change multiple file extensions but in separate folders? It’s a really weird thing I have to do. I need to be able to rename several folder.jpg files to folder.vob. There are all in different folders. There will be times when I need to change all those folder.vob back to folder.jpg but the problem is that a lot of other vob files will be in the same directories. So I need a way to change only files called folder.* to folder.jpg. Again – Every file is in a different folder.


  37. Webert Márcio said on :

    Hello people,

    Was in the struggle to solve my problem to change the file type and by the above information, I was able to do so. Thanks.

    Hugs


  38. AL said on :

    THANKS!!!! rename *.new *.old, WORKS the Fastest!


  39. Frank said on :

    I have a ton of pictures and I want to change the file extension from PNG to JPG. This was a lot of help.


  40. Darry said on :

    This little program is pretty sweet! Thanks for the mention. Now off to change loads of file extensions.


  41. tew said on :

    I’m not a geek, but I’m with hdjunkie. Open the command box. (Start –> Run, enter “cmd” in the little Run pop-up)

    Use the “cd” command to “change directory” to where the files are. (If you don’t know these commands, type “help” and get a list of commands. For specific command help type “help “. For example, “help cd” will show you how to use cd.

    Once in the directory type:

    rename *.new *.old

    Pretty simple and fast.


  42. Cloud Strife said on :

    Thx alot that program was really useful. like others here i also had to batch change extention so once again this was of a geat help.


  43. St said on :

    Hi- lots of intering stuff here- thanks.

    I want to rename certain file extensions in another folder to the batch file and can’t get this to work.

    I’m using:

    ren D:\batchtest1 *.123 *.456

    but it doesn’t seem to work. “ren *.123 *.456″ works fine but I need the batch file in another folder. Any suggestions appreciated. Thanks


  44. jim said on :

    using DOS far easier
    Renaming a batch of files can be done using a program that is specialised for that or you can just use a short command in DOS mode of your Windows. The code is not problematic, and you will be able to use it even if you are not familiar with the DOS environment.

    You can get into the DOS command prompt if you go to Start -> Run. Now you need to run the “cmd” program. So just type cmd and click OK. A new window will open, that will show you in what directory you are in. You need to navigate to the directory where you have the files that you would like to rename. Use the “cd..” and “cd target-directory” commands. “cd..” will get you to a directory lower, and “cd target-directory” will get you one directory up, into the target-directory that you specify. You can always go only one directory up, so if you would like to go to c:\program files\windows, you need to do “cd program files” and then “cd windows”.

    Now that you are in the target directory, use the command “ren *.txt *.doc”. “Ren” gives the computer the command to rename files. The second part of the command (*.txt) tells the shell to take all the files with the extension .txt and the third part (*.doc) tells it to rename all the files into the .doc extension.

    If you do not want to type so much, you can use one of the many programs, that are free to use and will do the job for you. You can use, for instance the “EF Multi file renamer 1.00″, free software that can rename multiple files, a whole directory and its sub directories, if you wish to do so. There are of course other programs out there, a lot of them have other functions, but you will need to pay for them, if you would like to use them.
    If you are renaming files on a regular basis, then you maybe should buy one of the programs, but if you just do it a couple of times a year, then just use the DOS command, as described above. It is the old school style, but just because of that it is a reliable way to get the job done.


  45. Carl said on :

    Can someone tell me how to do this using DOS or PowerShell commands? I want to create a script and deploy it to many user PCs on my Windows Server 2008 network.

    We have a bunch of files on many computers that need to have their file extensions changed due to a mistake. Can someone help?


  46. harish said on :

    thxx a lot………..u solved my problem. 1,000+ file extensions changed in seconds!


  47. Doris said on :

    You can also use the rename DOS command to batch change file extensions, no need for any additional software. Only if you need to batch rename files do you need extra software.


  48. Michal said on :

    Hi, If you are looking for some file extensions, take a peek at file-extensions.org. It is huge file extensions database. Have a nice day:-)


  49. Fernando said on :

    I cannot open some pictures on my computer, can you help me?


  50. Dave said on :

    Extension Renamer sucks. Don’t download it. It asks you to download an ancient version of the .NET framework(1.4!) in order to run. You gotta be kidding!


  51. rebeca said on :

    Thank you so much! This is a wonderful utility! Who knew there was such an easy way to change file extensions on so many files at once! ;)


  52. Omer said on :

    Hi,
    I have 100,000 files in a directory, all with .tif extension. A % of these should have been .pdf files and are wrongly extended as *.tif at the time of scan. Can anyone think of a way to identify which ones are real .tif files and which ones should be .pdf files without actually opening each one up? If we can identify that systematically, we can use the good knowledge on this blog to rename the incorrect .tif files to .pdf. Thanks in advance!


  53. Parmjit Singh said on :

    This worked for me, thanks a lot!


  54. tejas said on :

    thanks for the Extension Renamer program! It is awesome!


  55. Ken Rodgers said on :

    Probably already posted on here, but to change all file extensions in a windows directory. Open a command prompt and change to the desired directory if not already there.

    ren *.txt *.html

    This would rename all files that end with .txt extension to .html


  56. xyz said on :

    I have a lot of .BAK files on my computer. What are those and do I need them?


  57. Chris said on :

    I haven’t seen my problem here. I have a bunch of machine embroidery designs that always download with as a “TGZ” file type and a “tgz” extension. For example: Christmasangels.zip.tgz” Embroidery software won’t recognize them until I eliminate the “tgz.” How would I batch rename to eliminate an extension as opposed to changing it?

    Thanks.

    Also, if anyone knows why “tgz” attaches itself to these files, I’d love to know. The webmaster says it’s my anti-virus/internet security program and Trend Micro says it’s the website.


  58. Designer said on :

    Thanks! The action script I had made in Photoshop had exported all of my files to .jpg.jpg. Looking at the hundreds of photos with this extension, I was not very excited at the prospect of renaming everything. The instructions below took care of it! Thanks for posting these instructions – I wouldn’t have thought of it, even though it’s a simple concept. :)

    There’s an easier way (in Vista):

    Shift-right-click in the folder containing the files to be renamed.

    Click on “Open Command Window Here.”

    In the Command Window, type the DOS command for file renaming, as applicable: i.e.: ren *.jpgjpg *.jpg


  59. Josh Heglund said on :

    You can do it really easily in PowerShell! (Included in Windows 7 / Windows Vista). This will do it recursively for all directories below too, so use wisely.

    To rename a “.jpg” to a “.new” you can do the following:

    Get-ChildItem . -Recurse *.jpg | Rename-Item -newname { $_.name -replace ‘\.jpg’,’.new’ }

    It’s important to leave the “\” in there too (as an escape character…)


Please post your comments/suggestions!