However I would like to have the following result:
1.jpg
2.jpg
3.jpg
4.jpg
5.jpg
6.jpg
7.jpg
8.jpg
9.jpg
10.jpg
11.jpg
12.jpg
How can I sort the text to achieve this?
Best regards,
Hartwig
Short answer: you can't.
Long answer: there is a SORT utility in the GnuWin32 CoreUtils collection
that will sort according to numerical value.
Using your file names,
DIR /b produced
1.jpg
10.jpg
11.jpg
12.jpg
2.jpg
3.jpg
4.jpg
5.jpg
6.jpg
7.jpg
8.jpg
9.jpg
(as expected) and
dir /b *.jpg | c:\bin\sort -g
produced
1.jpg
2.jpg
3.jpg
4.jpg
5.jpg
6.jpg
7.jpg
8.jpg
9.jpg
10.jpg
11.jpg
12.jpg
The CoreUtils are free and open source at
<http://gnuwin32.sourceforge.net/packages/coreutils.htm>
In future, it would be advisable to use leading zeros on numbered files,
at as many digits in all as the largest number ever to be used.
--
T.E.D. (tda...@mst.edu)
Use 4DOS instead of COMMAND.COM. This sorting format -- logical,
rather than ASCIIbetical -- has been the default in 4DOS since the
late 1980s.
-------------
D:\TEST>ver /r
4DOS 8.00 MS-DOS 5.50
4DOS Build 200 (Feb 27 2009)
DOS Revision A; DOS is in HMA
D:\TEST>dir /b
1.jpg
2.jpg
3.jpg
4.jpg
5.jpg
6.jpg
7.jpg
8.jpg
9.jpg
10.jpg
11.jpg
12.jpg
D:\TEST>
-------------
Charles Dye