![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-09-23 15:27 |
47,812 topics / 349,917 posts / today 0 new / 48,273 members |
| DOS批处理 & 脚本技术(批处理室) » [Help] DOS program or batch file to automatically change numeric filenames under DOS |
| Printable Version 1,678 / 5 |
| Floor1 kumho | Posted 2005-11-23 13:00 |
| 初级用户 Posts 28 Credits 92 From nanjin | |
|
Question for the experts: for the DOS batch file below, how should the program be written?
1. There are many TXT files named with numbers (from small to large). Now I need to change all those numeric filenames as required (for example: add 100 to all of them), still keeping them in ascending order. 2. Take the renamed TXT files and, at a specified time interval (such as 10 seconds), copy them one by one in ascending order automatically to another place (such as C:\...TXT-----G:\...TXT) The above is a major problem I have run into recently, I kneel and beg the experts to tell me |
|
| Floor2 chenhui530 | Posted 2005-11-24 13:14 |
| 高级用户 Posts 273 Credits 772 | |
|
First say what your runtime environment is.
Also, what are the starting and ending values of your numbers? If it is a system 2K or above, and the starting value is 1 and the ending value is 100, then it can be like this: for /l %%a in (1,1,100) do ren %%a.txt %%a100.txt for /l %%b in (1,1,100) do wait 10000 && copy %%a100.txt g: |
|
| Floor3 无奈何 | Posted 2005-11-24 23:51 |
| 荣誉版主 Posts 356 Credits 1,338 | |
|
I didn't quite understand your question. Do you want to add 100 to the numeric value, or add the characters 100 before or after the filename? You'd better give some examples of the filenames and what they become after renaming. Are these filenames consecutive? If they are numbers, then naturally there are smaller and larger ones, so what is the range?
|
|
| Floor4 kumho | Posted 2005-11-30 16:49 |
| 初级用户 Posts 28 Credits 92 From nanjin | |
|
Hello: the numeric filenames are all 14 digits long... for example 11112222333333.TXT..... add 100 from small to large
There are 58 TXT files in total...... waiting again for your reply, thanks |
|
| Floor5 htysm | Posted 2005-12-07 11:34 |
| 高级用户 Posts 415 Credits 866 | |
|
To be honest-------your second explanation is even more confusing than the first one.
|
|
| Floor6 willsort | Posted 2005-12-07 21:36 |
| 元老会员 Posts 1,512 Credits 4,432 | |
|
Re kumho:
Your description of the problem really is somewhat vague and unclear. For example: you did not mention what system environment you are using, whether your filenames are consecutive numbers, and whether adding 100 is in the mathematical sense or the textual sense. If you are using it under cmd, then it will not be very complicated; if under DOS, then some special handling is needed, but that only applies to the specific application, so you need to describe it as completely and clearly as possible. |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |