In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail how to use batch processing to rename files digitally. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Request:
1. The order of a.txt content cannot be changed.
2. Rename all jpg files in the current directory in the form of serial numbers, such as: from 1mai 16
3. If there are 16 files, they must be renamed to 1-16. Serial numbers after 16 are not allowed.
A.txt content:
The code is as follows:
2.jpg
1.jpg
A.jpg
5ww.jpg
C.jpg
F.jpg
Rty.jpg
3.jpg
11.jpg
B.jpg
6.jpg
E.jpg
8.jpg
111.jpg
7.jpg
30.jpg
The content in a.txt is actually a list of jpg files under the current folder.
Requires that all jpg files in the current folder be renamed in the form of serial numbers.
However, you can only get the file names of all jpg in the current folder from a.txt.
Renaming a file with a sequence number has many pitfalls, but if you use commands such as dir or for to get the file name, the order of acquisition will be regular, resulting in some problems that can not be reflected.
The code is as follows:
@ echo on
Setlocal enabledelayedexpansion
Set nasty 0
Set n1mm 0
For / f "tokens=*" an in (a.txt) do (
Set / a naughty 1
Ren a tanning.jpg
)
: loop
Set / a N1 room1
Ren t%n1%.jpg% n1%.jpg&&goto: loop
Exit
The second method
It seems that it could be easier.
The code is as follows:
@ echo off
Ren * .jpg t*.jpg
Setlocal enabledelayedexpansion
For / f "delims=" an in ('dir/b "t*.jpg"') do (
Set str=%%a&set stranded struts 1!
Ren "a"! str!"
)
Pause
On "how to use batch implementation to rename files digitally" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, please share it out for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.