How to modify the file name in batches?

  

How to modify the file name in batches? [Using Excel and DOS Command Methods]

It is very simple to modify the file name in batches on your Windows computer. Select all the files, press F2, and enter a descriptive text.

Windows will add a unique sequence number to each file name.

This is a fairly quick solution, but it is not very flexible, because you can't customize the way it is modified.

For example, how do you add the current date to the file name? Or do you want to replace a few words or characters in the file name (such as a misspelling)? Or you want the file to be modified according to a different rename system, like file-A.jpg instead of the default file(1).jpg.

In order to effectively modify the file name in batches, you can learn some somewhat complicated shell programming languages ​​(SED, AWK, Perl) or simpler, just use a spreadsheet and several dos commands.

1: Click the "Start" menu in the lower left corner of Windows, select "Run", type cmd, and press Enter to enter the command line.

2: Use the cd command to go to the folder directory where you want to modify the file name in batches. For example, here, I want to enter the pics folder in the C drive.

cd

cd pics

3: Enter dir /b You can see a list of all the files in the current folder directory.

Enter dir /b > pics.xls to output the list to the pics.xls spreadsheet.

4: Interesting things are starting now. Open the Excel or Google Docs spreadsheet and you will see the list of files in the first column.

5: In the next blank column, add a corresponding function function formula - for example, use SUBSTITUTE to modify the characters specified in the file name, use CONCATENATE() and DATE() in the file name Add the date, and so on.

6: Select the + plus sign in the lower right corner of the B1 cell and drag down so that our formula will be copied to all rows.

Now, your original file name is in column A, and you want to replace the file name with column B - we will now convert them to the rename command in

in DOS.

In column C, enter the Excel formula:

=CONCATENATE("ren ",A1, " ", B1)

Click the function's checkmark to confirm that the input is correct. , drag to the + plus sign in the lower right corner and apply to all rows.

7: Select the C column, click "Copy", in the C disk pics folder directory, create a rename.bat file, paste the copied content into it.

8: Now we have basically finished. Enter the command rename.bat under C:pics and press Enter. You will find that the file names in the pics directory have all been modified in the way you expect.

Copyright © Windows knowledge All Rights Reserved