How to rename all File Extensions in a Folder at once in Windows 11/10

How to rename all File Extensions in a Folder at once in Windows 11/10

 

Assume you need to change the extension of a file from one kind to another, such as jpg to png. Of course, it’s simple! But what if you have many files that need to have their extensions changed? Worse, what if these multiple files are contained within several folders and subfolders within a single folder? For the average person, this is a nightmare. But definitely not for a geek. The question now is whether you are a geek or not. With The GEEK Page on your side, you most certainly are!

 

In this post, we will show you how to simply rename the extensions of all files inside a folder, including subfolders, from one extension to another of your choice using batch scripting.

Please keep in mind that in this example, we converted JPG images to PNG files. Other extensions, such as.mod to.mp4, can be renamed.

Rename the extensions of all files contained within a folder.
Step 1: On the Taskbar, click the Search button.

 

ADVERTISEMENT 1 Optimised Search Icon

 

Step 2: Type notepad into the Search field, and then select the Notepad application from the Best match area.

 

2 Notepad Search Optimization

 

Step 3: When the Notepad app appears, copy and paste the code snippet below into it.

FOR /R%%d IN (.) DO ( cd “%%d” IF EXIST *.from extension ( REN *.from extension *.to extension ) )
POPD
Please replace the previous extension with from extension> and the new extension with to extension>. In the example screenshot below, I’ve changed the extension from jpg to png. So my from extension> is jpg and my to extension> is png. You can switch from one extension to another at any time. This is only one example.

 

Optimized Code Snippets 3

 

Step 4: When you’re finished, go to the top and click on the File tab. Then select the Save As option.

 

Save As Optimized 4

 

Step 5: In the Save As window, navigate to the folder containing the files that require the extension change.

Give your script file a name now. The file’s name is jpg to png.bat. You can give it any name you like, but the extension must be.bat.

Now, select Save as type All files.

When you’re finished, click the Save button.

 

5 Save File Optimization

 

Step 6: Next, navigate to the location where you saved the batch file. This is the location of all your jpg files. This folder may have subfolders containing jpg files. All of the jpg files within each subfolder will now be changed to png.

To run the batch file, double-click it.

Please keep in mind that the files are JPG before running the batch file.

 

6 Optimized Execution

 

Step 7: After execution, you will notice that the file type has changed to PNG.

 

7 Optimized Png Changed

 

Step 8: If you go inside the subfolders and the subfolders’ subfolders, you’ll notice that the file extensions have changed to PNG.

 

8 Sub Sub Sub Sub Sub Changed Optimized

 

That’s all. With a single click, you have now successfully altered the extension of several files recursively.

I hope you found this post helpful.

Leave a Reply