How to change the extension of all files in a folder. Bulk Rename Files in Windows

For the purposes of testing one program, it was necessary to get an array from large files with txt extension (more than 3 MB), the content of which was not important. Without further ado, it was decided to simply rename copies of photo files taken from a digital camera. There were over 70 different jpg files in the original folder. Renaming "hands" of so many files is harmful for hands and for karma. Let's try to find simple methods to automate the process.

Consider two options for mass renaming:

  1. Built-in Windows
  2. Additional programs

Renaming using built-in Windows tools

Windows Explorer has the ability to bulk rename files. To do this, select desired folders, press F2, enter a new file name, for example, test, press Enter, and all files will become like this:

test.jpg, test(1).jpg, test(2).jpg etc. The extension cannot be changed. The method is very limited in its capabilities, so we do not dwell on it and do not single it out as a separate one.

Let's open the Windows console by pressing the Win + R key combination at the same time. The Win key is next to the space bar, it shows the Windows flag.

The Run window will appear:



We write in the line "Open:" the word cmd, as in the picture, click OK.

A Windows console window will open. We write in it cd [path to the folder with files to rename], press Enter. I have several jpg files in this folder that I need to "remake" into txt files, so next I write the command



Now I have a txt file in this folder, as I wanted.

The advantages of this solution:

  • Nothing needs to be downloaded from the Internet and installed, everything is already in Windows
  • Very fast solution

Cons of this solution:

  • Requires albeit a small, but still existing qualification of working at a computer from the user

Let's consider another option.

Renaming files with third-party programs

One of the most common options is renaming with Total Commander.

We open this program, go to the folder we need.



We have two options, depending on what we want to do. If you, like me, are only interested in changing the extension of the selected files located in the specified folder, then the first of those described below is more suitable for you, if you need a more cunning renaming, then it is better to turn to the second option.

Option 1. Simple change of extensions for folder files

In the right part of the window shown in the picture above, also go to the folder in which you want to change the file extension.



Use the Insert button to select the desired files or press the key combination Ctrl + A to select all files, and press the F6 button. The following window will open:



At the end of the first line in *.*, you need to replace the last asterisk with the extension with which we need to replace the extension of existing files, in my case *.txt.



Click OK, the extensions of the selected files have been replaced.

If we need a more tricky renaming, then we can try option 2.

Option 2: Bulk Rename Files

Also in the Total Commander window, select the folder we need. Then we select the files we need with the Insert button or press the key combination Ctrl + A (Select all), then Ctrl + M, a group renaming window will open:

As in the figure above, in the "Search and Replace" area in the "Find" field we write jpg, in the "Replace with" field we write txt. Click "Run" and enjoy the result. Until the first crash. It must be understood that if we go this way, then if the file was called, for example, jpg.jpg, it will be replaced by txt.txt. Fortunately, in this window there is a “Rollback” button (to whom ?!). So this species renaming is suitable if we need, for example, to add a counter to the file name. To do this, press the [C] button in the upper left part of this window and look at the preliminary result. In the field "Mask for: file name" should be written [N][C]. To separate the counter from the main file name, you can write in this field, for example, [N] ([C]). In the "Counter Options" area, you can specify from which digit to start counting, in what increment and how many digits should be displayed. You get this:



In the same way, we can add a date (Date button), time (Time button) to the file name), separating them for our own convenience with some symbol, for example, a dash.

Particular attention should be paid to advanced features, namely adding many other parameters to the file name by selecting the ones you need from the drop-down menu when you click on the “[=?] Plugin” button.



In the file name mask line, you can set the desired name format, for example, only the time the file was created in this folder:



The most discussed above simple options. You can search for files using a regular expression. To do this, in the "Search and Replace" area, check the "Reg. exp. ”, in the “Find” field we write our regular expression, and in the “Replace with:” field we write what we will replace everything found with. In my example, the simplest regular expression \d is involved, which looks for numbers in the file name and replaces them with the letter a. Note that the file called test.JPG is not involved in the replacement process, since there are no numbers in its name!



The advantages of this solution:

Cons of this solution:

Let's take a look at a couple of these alternatives.

Among free alternatives to Total Commander want to highlight. Everything described above is beautifully done in it, starting from a simple replacement of the extension, ending with searching for a file by name using a regular expression. At the same time, if you are familiar with Total Commander, or at least follow the screenshots given in this article, then you will notice that the program interface is very similar and understandable. By the way, it is Russified, which is very important for many people. Yes, of course, its functionality is reduced in relation to the "big brother", for example, it is impossible to calculate the checksum of the CRC32 file, and it is also impossible to synchronize directories, you can only compare. But the functionality of adding a comment to a file by Ctrl + Z has been preserved. Searching for files is possible not only by name, creation date, but also by content. True, after the file is found, it can only be edited, it cannot be opened by double-clicking, which is strange ... You can find the file over the network using the disk called \\ at the top of the program or by clicking on the menu item "Open VFS List" . I would especially like to highlight the presence of our own built-in test editor with the ability to choose an encoding and even syntax highlighting!

The program has a similar functionality, it is also Russified. Its interface is not at all as boring as the previous two programs, its file name change is also very similar to what is presented in the previous two programs. However, the regular expression search let us down. But, I think, this is not the most poppy functionality for Total Commander either. There is the ability to synchronize folders and compare them. Here the program has a clear advantage. The program provides the ability to connect network drive. In general, judging by the menu item Tools -> Remap Win + E for FreeCommander, the program is quite ambitious. Doesn't know how to calculate checksums, except for MD5, doesn't know what a file comment is. By pressing F4, it opens the editor set in the system by default, that is, it does not have its own built-in one. The search is also carried out both by the properties of the file and by the content, moreover, by double-clicking the file opens in the standard program for it, specified in the system. This is a definite plus!

P.S. The FreeCommander program has such a menu item File -> "Destroy" ... When I looked at it out of the corner of my eye, I thought that, judging by the icon, this is a seal, which is somehow strange O_o. I looked at the key combination Shift + Ctrl + Del, apparently, really destruction ... Ahh, this is not a printer, but a shredder! That's it =)

So think, decide whether to have Total Commander or not!

If the files in Windows system registered - that is, for them there are programs that open these files by default - in the explorer they are displayed only with the name. The extension of such files is not displayed in the explorer.

This is done for the convenience of users. Since files of a particular format are displayed in Explorer with the icon of their default opener, users can concentrate on the name of the file when searching for the desired file, and not on technical information like: extension, size, other subtleties. However, sometimes displaying the file extension may be necessary. These can be experiments with files, when, for example, a text document format needs to be turned into a settings file, as is the case with . This may be the launch of “.exe” files downloaded from the Internet, which sometimes their creators protect from inexperienced users with an unfinished letter in the extension.


You can not do without manipulating the change in the name of the extension and in cases where bookmarks Internet Explorer were exported to the “.htm” file, which is automatically generated by the standard browser of the system during the export process. Indeed, in the future, it will be possible to import bookmarks into any other third-party browser only by manually adding the letter “l” to get the “.html” file.


How to rename a file extension in Windows?

This does not require any special program editors and complex commands. Renaming file extensions is done in exactly the same way as changing their names.

How to rename file extension in Total Commander

In the Total Commander file manager, which many users are probably familiar with, displaying files along with extensions is provided from the very beginning. Immediately after installing the Total Commander program, without making any settings, we will see the display of extensions along with file names. In the window file manager, by pressing the F2 key on the selected file, we can start renaming - both the file itself and its extension.


How to display file extensions in Windows Explorer

To rename extensions in Windows Explorer, you must first enable their display for those files for which the system has default programs assigned. In order for the files to be displayed with both the name and the extension, this option must be set in the folder options. How to enable display of file extensions in Windows 7 and 8 and 8.1 systems?

Windows 8 and 8.1

In Windows 8 and 8.1, open File Explorer, go to the "View" tab, click "Settings", and then click the button to change them.


In the folder options window that appears, move to the "View" tab and uncheck the option to hide file extensions that have installed programs default. Click "Apply" and "OK".

Changing the name of one or more files is an elementary thing. But if you need to do a group rename of files, the number of which exceeds several tens or even hundreds of pieces, manually entering new names can take several hours, or even more. Fortunately, there are special programs, as well as some tricks that allow you to minimize the time spent and avoid routine manual work. Therefore, if you want to put things in order in your music or photo collection, give understandable names to all stored files, now is the right time to do it. Let's take a look at the best way to batch rename files that have accumulated on your computer.

The mass change of names depends, first of all, on which operating system you are using. Here are some tricks for the most popular operating systems:

  • Windows 7

The easiest way to rename files on this system is inside Explorer). First you need to place all the necessary files in a separate directory so as not to accidentally hook on extra documents. Now select them using the combination "Ctrl + A" and right click We call the mouse in which we select the "Rename" item. We enter a common name, for example "wallpaper", and all our selected files will receive new names consisting of a common name and a serial number in parentheses ("wallpaper (1)", "wallpaper (2)", "wallpaper (3)" and etc.).


You can also bulk rename files using command line. In this case, using "Win + R" launch the window desired application, we type “cmd” in the line, and by pressing “Enter” we open it. In it, with the “cd” command, specify the path to the folder with files, for example, for the “pics” folder on the D: \ drive, the command will be as follows: cd d: \ pics. Let's say we want to change the file extension from "GIF" to "JPG". Let's use the "rename" command or "ren" for short and write ren *.gif *.jpg. The command itself and extensions must be separated by a single space.

  • linux

On this system, file renaming can be done with standard utility Rename. The command for the Rename utility looks like this:

rename [ -v ] [ -n ] [ -f ] perlexpr [ files ];

[ -v ] - show new filenames;

[ -n ] - display a list of files selected for renaming;

[ -f ] - overwrite existing files if they match;

perlexpr is a template for renaming.

Suppose there are files in the folder with the extension ".txt" among others, and we want to rename them to "mytext.bak". Then the command will look like:

rename "s/.txt/.mytext.bak/g" *.txt

Let's explain what our template means:

s - substitution required;

/.txt/ - what to replace;

/.mytext.bak/ - new name;

g is global, the operation will affect all occurrences found.

The "rename" command can also help with bulk case changes. The expression "rename ‘y/a-z/A-Z/’ *" converts all names, making them fully spelled with


  • MacOS

Renaming files in this environment is not as convenient and easy as in Windows. The Finder does not natively have this feature, but it can be added via Automator. To do this, launch this standard application and select "Service". Then in the library, go to the "Files and folders" item. It has a sub-item called "Rename Finder Items". It must be moved to the editing zone, while refusing to copy. In the "Service receives" window, set "Files or folders". Then we put "Use this service in the Finder application", in the renaming options themselves, check the box "Show in progress" and set the "Make sequential" option. Now it remains only to check and save the settings.

In order to rename files with additional settings (moving, transliterating, searching by tags), it is better to use special universal utilities such as "SVS RenameFiles", "Multi Renamer", "Advance Renamer", etc.