China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-02 14:15
Original Poster Posted 2006-12-02 14:48 ·  中国 江西 赣州 电信
高级用户
★★
论坛上抢劫的
Credits 551
Posts 246
Joined 2006-09-21 12:35
19-year member
UID 63270
Status Offline
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
Floor 2 Posted 2006-12-02 15:03 ·  中国 四川 泸州 电信
初级用户
Credits 54
Posts 27
Joined 2006-12-02 11:46
19-year member
UID 72370
Gender Male
Status Offline
It seems not. Just change "第1章.txt" to "第01章.txt" and it will be okay.
Floor 3 Posted 2006-12-02 20:12 ·  中国 广东 电信
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
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.
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。
Floor 4 Posted 2006-12-02 21:31 ·  中国 广东 广州 教育网
铂金会员
★★★★
C++启程者
Credits 5,154
Posts 1,827
Joined 2003-07-18 00:00
23-year member
UID 7105
Gender Male
Status Offline
The requirements of the thread starter itself have no pattern
Floor 5 Posted 2006-12-03 03:49 ·  中国 江西 赣州 电信
高级用户
★★
论坛上抢劫的
Credits 551
Posts 246
Joined 2006-09-21 12:35
19-year member
UID 63270
Status Offline
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.
Floor 6 Posted 2006-12-03 04:07 ·  中国 甘肃 张掖 电信
金牌会员
★★★★
Credits 4,103
Posts 1,744
Joined 2006-01-20 13:00
20-year member
UID 49241
Gender Male
From 甘肃.临泽
Status Offline
sort 不知道可以吧?
Floor 7 Posted 2006-12-03 04:22 ·  中国 北京 东城区 联通
金牌会员
★★★★
Credits 2,902
Posts 1,147
Joined 2006-09-21 12:00
19-year member
UID 63324
Gender Male
Status Offline
```
dir /b 第?章.txt > List.txt && dir /b 第??章.txt >> List.txt


The obtained file list is stored in the List.txt file:

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

Recent Ratings for This Post ( 2 in total) Click for details
RaterScoreTime
youxi01 +4 2006-12-03 05:04
ccwan +5 2006-12-03 21:06
    Redtek,一个永远在网上流浪的人……

_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._
Floor 8 Posted 2006-12-03 13:39 ·  中国 山东 济南 移动
钻石会员
★★★★★
Credits 10,051
Posts 3,040
Joined 2002-11-11 00:00
23-year member
UID 223
Gender Male
Status Offline
Simplify complex problems---a smart move!
简单就是美
Floor 9 Posted 2006-12-03 21:07 ·  中国 河北 廊坊 三河市 移动
金牌会员
★★★★
Credits 2,725
Posts 1,160
Joined 2006-09-23 12:00
19-year member
UID 63486
From 河北廊坊
Status Offline
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
Forum Jump: