Greetings,
are there any means of functions that can be used so that the dir output or equivilent would order the files in human order hence:
currently if you have a directory with files named such as file1 thru 30,
the dir would list and sort by the first number and not in number sequence.
i need for the output to be in sequence,
any ideas?
DIR listing order
Moderator: DosItHelp
Matice,
Go to "Batch Files" "11 - Sorting text with numbers" and download the sortn.bat file.
http://www.dostips.com/DtCodeBatchFiles.php#_Toc145951142
Then from a command line pipe the output of a dir command into sortn.bat like this:
Make sure sortn.bat is accessible if not use the full path name e.g.:
This was a nice exercice
Does it solve your problem?
Go to "Batch Files" "11 - Sorting text with numbers" and download the sortn.bat file.
http://www.dostips.com/DtCodeBatchFiles.php#_Toc145951142
Then from a command line pipe the output of a dir command into sortn.bat like this:
Code: Select all
dir /b|sortn
Make sure sortn.bat is accessible if not use the full path name e.g.:
Code: Select all
dir /b|c:\sortn
This was a nice exercice
Does it solve your problem?
RE:
I must hand it to you, you did a great job with that. you are the GURU!
here is a next question!
in bash one can perform a sequence in loops, can the same be done in dos?
something like
instead of
for %%I in ( 1 2 3 4 5 6 7 8 9 ) do echo %%I
have something like
for %%I in (inc 1 9) do echo %%I
regards
Matice
here is a next question!
in bash one can perform a sequence in loops, can the same be done in dos?
something like
instead of
for %%I in ( 1 2 3 4 5 6 7 8 9 ) do echo %%I
have something like
for %%I in (inc 1 9) do echo %%I
regards
Matice
DosItHelp wrote:Matice,
Go to "Batch Files" "11 - Sorting text with numbers" and download the sortn.bat file.
http://www.dostips.com/DtCodeBatchFiles.php#_Toc145951142
Then from a command line pipe the output of a dir command into sortn.bat like this:Code: Select all
dir /b|sortn
Make sure sortn.bat is accessible if not use the full path name e.g.:Code: Select all
dir /b|c:\sortn
This was a nice exercice
Does it solve your problem?