Modify file names in batches (by using excel tables and modifying bat files. The current problems have been solved)

face the scene

Nowadays, many office workers will encounter a trouble. The document below is basically in the format of name + student number/employee number, but when submitting it, you need to submit a string of numbers, and the format is relatively strict. In this scenario, copying and pasting one by one is really troublesome and inefficient.
The above problems can be solved by batch modifying file names using excel tables and modifying bat files. The specific method is as follows. (The solution to the problem is at the end)

specific method

Take for example how I modified my image.

Insert image description here
Here are some pictures that I found elsewhere or screenshots.
It's obvious that the names are all gibberish.
First, remove the spaces between all the names in the modified part. There is a "Quick Delete.bat" in the link below. Drag it to the folder and double-click it to delete all the spaces in the folder.
Link: https://pan.baidu.com/s/1tJHnogGUcLy_p2_LPLInuA?pwd=0505
Extraction code: 0505
As shown in the picture, I added some spaces to the box part for demonstration.
Insert image description here
Double-click the bat file. A running interface pops up and disappears in about a second.
Insert image description here
You can see that all the spaces have been removed.
The second step is to edit the excel table.
Insert image description here
Copy the address of the folder and paste it at the top of the browser. Press Enter and you will see a page like this shown
Insert image description here
below . Use ctrl+a to copy all.
Insert image description here
(Copying only part of it may not be successfully pasted into the excel table)
Create a temporary excel file on your computer and copy it into the table.
Insert image description here
Insert image description here
Delete unused rows and columns. Just leave the file name as a column.
Insert image description here
The reason why the name is so big is that it contains a hyperlink (connected to a file on the computer, but it cannot be opened in Excel.)
Select the entire column and right-click to cancel the hyperlink.
Insert image description here
Insert image description here
Then insert a column to the left of the original name of the file, write ren, and pull down to fill the entire column.
Insert image description here
Fill in the newly modified name to the right of the original name of the file.
Here I want to change some to jpg and some to png. Just write the suffix directly at the end.
Insert image description here
The figure shows various naming forms. You can modify it at will. The suffix for word documents is doc or docx, the suffix for pdf is pdf, and the suffix for compressed files is zip or rar. Modify by personal modification type.
The third step is to create a new txt file in the original folder.
Insert image description here
Copy the content in excel directly. Because there are spaces when copying from excel to the file, you don't need to add them yourself. The purpose of importing the deletion file "Quick Delete.bat" before was to ensure that the spaces here correspond to each other one by one. Otherwise, modification errors or garbled characters may occur.
Insert image description here
Click on the upper left corner of the txt document: File->Save As.
Modify the file suffix to bat. Encoded as ANSI . The computer's default encoding is generally UTF-8. When saving as a bat file and running it, there will be encoding mismatching resulting in garbled characters that cannot be modified. So this step is necessary.
Insert image description here
Insert image description here
Double-click "New Text Document.bat".
The black running box flashes through and usually ends in about one second. (If the file is too large, the time may be extended accordingly.)
Wait about two seconds and all names will be automatically modified.

Insert image description here
There are files with the same name after modification in my excel document. It can be seen that after the modification is completed, the second modified document will not be modified.
Insert image description here
At this time, there are three more files in the folder, namely "Quick Delete.bat", "New Text Document.txt", and "New Text Document.bat". Just delete it.
Insert image description here
Modification completed.

Q&A

1. You may encounter a situation where you double-click the bat file and find that the file has not been renamed.
In this case, please study and observe whether there are clean spaces in the document. You can use "Quick Delete.bat" once, or search whether there are spaces in excel through ctrl+f.
It is also possible that there are special symbols in the name. Just remove the special symbols and repeat the above steps.
2. Can I modify the file suffix at will?
No, you can only use jpg, png or jpeg for pictures, these are interchangeable. If you forcibly change the suffix, such as changing it to GIF, the file will basically be unable to be opened.
3. Can the name be changed to a pure number or Chinese character name?
Yes, my example includes pure Chinese characters, pure numbers and text + numbers. The results can be modified.

If you still have any questions, you can message me privately. I know everything I know and can tell you everything I know.
Thank you for your support. Any errors will be corrected as soon as possible.

Guess you like

Origin blog.csdn.net/gelly_/article/details/131327188