Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Batch rename files using REN in Windows 7 (adding prefix)

I have figured out how to edit batches of files using REN in Windows 7 Command Prompt. However, this time, I am trying to add a prefix to all files but I am unable to do it. All files are tif files.

For instance, files are located in C:\Users\user1\Desktop\Test_Folder
Files inside each folder begin with 9.
Each file has 5 digits (i.e 90200, 90201, 90202).

I am trying to add a 0 (zero) in front of each file name and change it to 090200, 090201, 090203....

I tried:

FOR %v IN (?????.tif) DO REN %v 0%v

I also tried:

FOR %%a in (*.tif) DO REN "%%a" "0%a"

Please help.

like image 475
user2237330 Avatar asked Apr 02 '13 18:04

user2237330


People also ask

How do I bulk rename files in Windows 7?

To batch rename files, just select all the files you want to rename, press F2 (alternatively, right-click and select rename), then enter the name you want on the first file. Press Enter to change the names for all other selected files.

How do I batch rename files with different names?

Select multiple files in a folder. To do so, press and hold down the CTRL key while you are clicking files. After you select the files, press F2. Type the new name, and then press ENTER.


1 Answers

This one is simpler ...

forfiles /M *.tif /C "cmd /c ren @file 0@file"

Source: https://www.windows-commandline.com/rename-file-extensions-bulk/

like image 71
user1573932 Avatar answered Sep 22 '22 14:09

user1573932