![]() |
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-08-02 15:34 |
48,038 topics / 350,123 posts / today 1 new / 48,251 members |
| DOS批处理 & 脚本技术(批处理室) » dir help |
| Printable Version 1,541 / 8 |
| Floor1 lotus516 | Posted 2006-12-02 14:48 |
| 高级用户 Posts 246 Credits 551 | |
|
I dir a folder, and the files obtained are arranged as follows:
Chapter 10.txt Chapter 11.txt Chapter 12.txt Chapter 13.txt Chapter 14.txt Chapter 15.txt Chapter 16.txt Chapter 17.txt Chapter 18.txt Chapter 19.txt Chapter 1.txt Chapter 20.txt Chapter 21.txt Chapter 22.txt Chapter 23.txt Chapter 24.txt Chapter 25.txt Chapter 26.txt Chapter 27.txt Chapter 28.txt Chapter 29.txt Chapter 2.txt Chapter 3.txt Chapter 4.txt Chapter 5.txt Chapter 6.txt Chapter 7.txt Chapter 8.txt Chapter 9.txt I want to get the following arrangement. What are the parameters? Chapter 1.txt Chapter 2.txt Chapter 3.txt Chapter 4.txt Chapter 5.txt Chapter 6.txt Chapter 7.txt Chapter 8.txt Chapter 9.txt Chapter 10.txt Chapter 11.txt Chapter 12.txt Chapter 13.txt Chapter 14.txt Chapter 15.txt Chapter 16.txt Chapter 17.txt Chapter 18.txt Chapter 19.txt Chapter 20.txt Chapter 21.txt Chapter 22.txt Chapter 23.txt Chapter 24.txt Chapter 25.txt Chapter 26.txt Chapter 27.txt Chapter 28.txt Chapter 29.txt |
|
| Floor2 lbccyxs | Posted 2006-12-02 15:03 |
| 初级用户 Posts 27 Credits 54 | |
|
It seems not. Just change "第1章.txt" to "第01章.txt" and it will be okay.
|
|
| Floor3 namejm | Posted 2006-12-02 20:12 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
You need to replace the "×" in Chapter × with a two-digit number, padding with 0 in front if it's less than two digits, and then sort them in ascending order? After looking at the descriptions of your two floors, I'm still not very sure about exactly what purpose you want to achieve. Please make your meaning clear.
Also, is this "×" only in Arabic numeral format? Please state the complete requirement so that it's easier to write code. |
|
| Floor4 GOTOmsdos | Posted 2006-12-02 21:31 |
| 铂金会员 Posts 1,827 Credits 5,154 | |
|
The requirements of the thread starter itself have no pattern
|
|
| Floor5 lotus516 | Posted 2006-12-03 03:49 |
| 高级用户 Posts 246 Credits 551 | |
|
Is my language really bad? The second time someone couldn't understand what I meant!!!!!!! Sweat!!!!!!!
I mean the original file names are from Chapter 1 to Chapter 29, and I don't change the original file names. DIR a folder > 1.txt, and the TXT text should be arranged from small to large. Don't arrange like the first one above where 10-19 are arranged first, then 1, then 20-29, then 2, then 3-9!!My purpose is to get the arrangement from 1-9, then 10-19, then 20-29 like this!!! Because it's difficult to generate other files that can be sorted in ascending order with batch (or I'm not capable enough?), so only the Arabic numeral format is considered!! Also, if I use batch to generate files named 01-20 like this, how should the FOR statement be written? The method of reading variables from the text is not considered. |
|
| Floor6 vkill | Posted 2006-12-03 04:07 |
| 金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽 | |
|
sort 不知道可以吧?
|
|
| Floor7 redtek | Posted 2006-12-03 04:22 |
| 金牌会员 Posts 1,147 Credits 2,902 | |
|
```
dir /b 第?章.txt > List.txt && dir /b 第??章.txt >> List.txt The obtained file list is stored in the List.txt file: |
|
| Floor8 Michael | Posted 2006-12-03 13:39 |
| 钻石会员 Posts 3,040 Credits 10,051 | |
|
Simplify complex problems---a smart move!
|
|
| Floor9 ccwan | Posted 2006-12-03 21:07 |
| 金牌会员 Posts 1,160 Credits 2,725 From 河北廊坊 | |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |