How to batch rename multiple files on Windows 10


https://www.windowscentral.com/how-rename-multiple-files-bulk-windows-10

When you have to rename a lot of files in a folder, it can be tedious changing the names one at a time, but Windows 10 offers various ways to make this process easier.
 
Mauro Huculak
On Windows 10, renaming a single file is a straightforward process, but it can quickly become a laborious task when you need to change the name or extension of a long list of files inside of a folder.
Although you can use many third-party tools to get this job done, Windows 10 provides some ways to quickly rename multiple files using File Explorer, and even with more flexibility using a single command with PowerShell and Command Prompt.
In this Windows 10 guide, we walk you through three different ways to quickly rename multiple files without third-party tools.

How to rename multiple files using File Explorer

Using File Explorer, you can select a file and hit the "F2" key to rename it, but this experience also allows you to quickly rename multiple files in bulk in at least two different ways.

Renaming multiple files using the Tab key

If you want to rename multiple files quickly with different names, you can use these steps:
  1. Open File Explorer.
  2. Browse to the folder that includes all the files you want to rename.
  3. Select the first file in the list.
  4. Press the F2 key to rename it.

    Quick Tip: Alternatively, you can click the Rename button in the "Home" tab. You can right-click the file and select Rename. Or you can click the file and then click it again to rename it.
  5. Type a new name and press the Tab key to jump to the next file automatically.
  6. Type a new name for the file and press the Tab key again to continue renaming files.

Renaming multiple files in bulk

If you need to rename multiple files at once using the same name structure, you can use these steps:
  1. Open File Explorer.
  2. Browse to the folder that includes all the files you want to rename.
  3. Select all the files.
    Quick Tip: You can use the Ctrl + A keyboard shortcut to select all the files. You can press and hold the Ctrl key and then click the files you want to rename. Or you can select one file and press and hold the Shift key, and then click the last file to select a range of files.
  4. Press the F2 key to rename it.
  5. Type a new name for the file and press Enter.

As you enter the new name and press the Enter key, all the selected files will be renamed using the same structure. However, you'll notice that they will use a different number between parentheses. For example, nyc_trip (1).jpg and nyc_trip (2).jpg.

How to rename multiple files using Command Prompt

It's also possible to the use the ren (or rename) command to change the name of a single file as well as multiple files and extension in bulk.
Use these steps to open Command Prompt in the desired folder location with the files you want to rename:
  1. Open File Explorer.
  2. Browse to the folder that includes all the files you want to rename.
  3. In the address bar, type cmd and press Enter.

    Quick Tip: You can follow these steps to return the "Open command windows here" option to the Windows 10's context menu.
While in the folder location, you can use the ren or rename command to bulk rename your files in a number of ways:

Renaming a single file

To rename only one file, use the following command syntax and press Enter:
ren "old-filename.txt" "new-filename.txt"
Command syntax example:
ren "nyc_trip_notes.txt" "nycTripNotes.txt"
It's worth noting that you can run the command without the quotation marks, but they're required if you're trying to change the name of the file that includes one or multiple spaces.

Renaming multiple files

To rename multiple files, use this command syntax and press Enter:
ren *.ext1 ???-new_filename_part.*
Command syntax example:
ren *.jpg ???-hikingTrip.*
In the command syntax example, the asterisk (*) is a wildcard that tells the ren command to match everything with a .jpg extension. The question mark (?) is also a wildcard, but it represents a character of the original file name. So, in the syntax, we're using three question marks, which means that the output file name will include the first three characters of the original file (which works as a unique identifier to avoid duplication) plus whatever name you're using after the question mark.
For instance, if you're renaming mountain-day2.jpg and lake-day3.jpg, using this command syntax, the output will look like this: mou-hikingTrip.jpg and lak-hikingTrip.jpg.

Making filenames shorter

In the case that you have a long list of files using long names, and you simply want to make them shorter, you can use this command syntax:
ren *.* ?????.*
In the command syntax example, the asterisk (*) matches all the file names and extensions in the folder, and the question marks (?) indicates how many characters to use for the file name. In this case, if the file name is less than five characters, then the name will not change. (If you want to make the file name longer add extra question marks.)

Changing part of the file name

To rename part of the file name on similar files, use the following command syntax structure and press Enter:
ren old_filename_part*.* new_filename_part*.*
Command syntax example:
ren nyc_*.* newYork_*.*
The command syntax example changes the first four characters of all files beginning with "nyc_" to "newYork_." For example, running the above command, the nyc_trip (1).jpg and nyc_trip (2).jpg files will be renamed to newYork_trip (1).jpg and newYork_trip (2).jpg.

Changing files extension

If you have a lot of files with a particular file extension, and you want to change it to another compatible extension, you can use the following command:
ren *.ext1 *.ext2
Command syntax example:
ren *.txt *.doc
The command syntax example changes the .txt file extension to .doc format of all the files in the folder.
In the case that you're only changing the extension of a single file, you don't need to use the wildcard (*). Here's a command syntax example: ren old_filename.txt new_filename.doc

Renaming files with a specific file extension

The Command Prompt command syntax examples shown above will rename all the files within the location. However, if you simply want to rename a particular file format, such as documents, images, or videos, you need to specify the extension in the command.
For instance, using the ren nyc_*.* newYork_*.* command will rename all files in the folder. If you want to rename only images files with a .jpg extension, you can use the following command syntax and press Enter: ren nyc_*.jpg newYork_*.jpg.

How to rename multiple files using PowerShell

PowerShell is an advanced command line tool built into Windows 10, which allows you to manipulate filenames in numerous ways. However, in these instructions, we'll walk you through the most common scenarios to rename one or multiple files in bulk.
To open PowerShell in the location that contains the files you want to rename, use the following steps:
  1. Open File Explorer.
  2. Navigate to the folder with the files you want to rename.
  3. Click and hold the Shift key, right-click an empty space in the folder, and select the Open PowerShell window here option.

While in the folder location, you can use the Dir command to list the files along with Rename-Item command with different options to batch rename your files in a number of ways:

Renaming a single file

To rename only one file, use the following command:
Rename-Item "original_filename.ext1" "new_filename.ext1"
Command syntax example:
Rename-Item "nyc_trip_notes.txt" "nycTripNotes.txt"
You can run this command without the quotation marks, but they're required if you're trying to change the name of the file with one or multiple spaces.

Renaming multiple files in bulk

To rename multiple files in bulk when the name structure isn't important, use this command syntax and press Enter:
Dir | %{Rename-Item $_ -NewName ("new_filename{0}.ext1" -f $nr++)}
Command syntax example:
Dir | %{Rename-Item $_ -NewName ("nyc_trip_{0}.jpg" -f $nr++)}
If you run the command syntax all the images with a .jpg extension will be renamed using the same structure. However, you'll notice that they will use a different number at the end of the name. For example, nyc_trip_0.jpg and nyc_trip_1.jpg.

Making file names shorter

To make file names shorter, or trim part of the names by an N number of characters, use this command syntax and press Enter:
Dir | Rename-Item -NewName {$_.name.substring(0,$_.BaseName.length-N) + $_.Extension}
Command example:
Dir | Rename-Item -NewName {$_.name.substring(0,$_.BaseName.length-4) + $_.Extension}
In the command syntax example, you'll notice the "$_.BaseName.length-4" part of the syntax that includes number "4" (you can use any number you want) this indicates that the command will trim the name of your files by four characters.

Removing part of the filename

To remove part of the filename on multiple files, use the following command syntax structure and press Enter:
Dir | Rename-Item -NewName {$_.name -replace "old_filename_part",""}
Command syntax example:
Dir | Rename-Item -NewName {$_.name -replace "tower",""}
The command syntax example removes the word "tower" from the name of all files in the folder.

Renaming part of the file name

To rename the same part of the file name on similar file names, use the following command syntax structure and press Enter:
Dir | Rename-Item -NewName {$_.name -replace "old_filename_part","new_filename_part"}
Command syntax example:
Dir | Rename-Item -NewName {$_.name -replace "tower","building"}
The command syntax example replaces the word "tower" for "building" of all the files that contain the word "tower" as part of the file name.

Removing spaces in file names

To remove and replace spaces with underscores, use the following command syntax and press Enter:
Dir | Rename-Item -NewName { $_.Name -replace " ","_" }
The above command syntax example replaces any spaces with an underscore of all files in the folder. (You can always change "_" for anything you want, including "-," and "$".)

Changing files extension

To change the file extension for a bunch of files, you can use the following command and press Enter:
Dir | Rename-Item -NewName { [io.path]::ChangeExtension($_.name, "ext2") }
Command syntax example:
Dir | Rename-Item -NewName { [io.path]::ChangeExtension($_.name, "doc") }
The command syntax example replaces the ".txt" extension for the ".doc" extension.

Renaming files with specific file extension

The PowerShell command syntax examples shown above will rename all the files within the location. However, if you simply want to rename a particular file format, such as documents, images, or videos, then you can use the "-filter" option.
For instance, if you want to rename only image files with a .jpg extension, use the following command syntax and press Enter:
Dir -filter *.jpg | %{Rename-Item $_ -NewName ("nyc_trip_{0}.jpg" -f $nr++)}
In the above command remember to replace jpg in the "-filter *.jpg" part with the extension of the files you want to rename. Also, remember to change "new_filename" and "jpg" in the "new_filename{0}.jpg" part with the file name and extension you want to rename your files.
The output of this command will look like this: nyc_trip_1.jpg, nyc_trip_2.jpg and nyc_trip_3.jpg.
These commands have been tested by us, but it's always recommended to test them before running them in the folder with the actual files you want to rename.

More Windows 10 resources

For more helpful articles, coverage, and answers to common questions about Windows 10, visit the following resources:

Popular posts from this blog

7 Free PDF Editors You Can Use on Any PC

4 Useful Freeware to Check and Repair Bad Sectors on SSD Drives