Discussion:
For Schleife sortieren
(too old to reply)
Axel Berger
2013-02-16 12:55:16 UTC
Permalink
I'm using 4DOS. Using the command

for %a in (acc*) do type %a >> logneu.txt

it is obvious they're executed in their natural order. If those files
were copied before I often hit the Windows idiosyncracy, that the first
in alphabetical order comes last, requiring manual correction. Is there
a way to make For use a predifined oder like aphabetical or age?

Danke
Axel
E. S. Fabian
2013-02-16 13:20:44 UTC
Permalink
Axel Berger:

| I'm using 4DOS. Using the command
|
| for %a in (acc*) do type %a >> logneu.txt
|
| it is obvious they're executed in their natural order. If those
| files were copied before I often hit the Windows idiosyncracy, that
| the first in alphabetical order comes last, requiring manual
| correction. Is there a way to make For use a predifined oder like
| aphabetical or age?

Sorry, not in 4DOS; not even in TCC/LE. The /O (order) option was added in
TCC version 11.

You can use the DIR command to create an ordered list of the files to be
processed in a temporary file (or in the clipboard), and retrieve them
(WARNING! NOT TESTED!):

dir /b /o:d acc* > clip:
( for %a in (@clip:) type %a ) > logneu.txt

Note that instead of redirecting each TYPE command individually the output
of the whole FOR loop is redirected. This is not essential, it is just a
techniqued you may not be aware of.
--
HTH, Steve
foxidrive
2013-02-16 14:41:12 UTC
Permalink
Post by E. S. Fabian
| I'm using 4DOS. Using the command
|
| for %a in (acc*) do type %a >> logneu.txt
|
| it is obvious they're executed in their natural order. If those
| files were copied before I often hit the Windows idiosyncracy, that
| the first in alphabetical order comes last, requiring manual
| correction. Is there a way to make For use a predifined oder like
| aphabetical or age?
This will sort by name: dir /b /o:n

The unsorted dir listings is an issue with FAT32/16/12, and NTFS sorts files alphabetically by default.


Another thing to watch is if acc* is a set of .txt files then make the target file a different extension
and rename it after the command. This gets around a bug in for-in-do.
--
foxi
Richard Bonner
2013-02-18 11:23:56 UTC
Permalink
Post by Axel Berger
I'm using 4DOS. Using the command
for %a in (acc*) do type %a >> logneu.txt
it is obvious they're executed in their natural order. If those files
were copied before I often hit the Windows idiosyncracy, that the first
in alphabetical order comes last, requiring manual correction. Is there
a way to make For use a predefined order like aphabetical or age?
Axel
*** In real DOS, this can be done by using a resort utility such as
Norton's DS.exe (Directory Sort). It physically reorders file namess in a
directory. Afterward, any listing, copying or other operation will then
happen in the type of order you select.

XSET, and possibly XXCOPY, could be used to do this operation, but I
can't take the time right now to think of the steps required.

I think the idea proposd by another poster of using DIR to send an
alphabetical list to a file and then using it as input to type each file
is likely the best for you.
--
Richard Bonner
http://www.chebucto.ca/~ak621/DOS/
Axel Berger
2013-02-18 14:41:53 UTC
Permalink
Post by Richard Bonner
I think the idea proposd by another poster of using DIR to send an
alphabetical list to a file and then using it as input to type each
file is likely the best for you.
I agree.

Loading...