Discussion Locked

Directory Sorting DOS verses Windows

0 helpful
9 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

When sorting a directory using the /on switch in a DOS Window the file order is different from sort on the the name in Windows Explorer. Any idea what is causeing this? I limit my file names to 8 charactors below is a directory name sample:
A2c---a-.tif
A2c--aa-.tif
A2c---b-.tif
A2c---b1.tif
A2c--bb-.tif
A2c---c-.tif
A2c--cc-.tif

9 replies

by tbradley

The above sample, how does it differ from the other? You didn't say if this was the dos example or windows.

The only difference I know of is that dos and windows handles special characters differently, ie Windows puts _ and ~ at the beginning ofthe list, dos puts them at the end.

by lo

Humm - that is 'odd'. I get the same/similar to yours with both Win Explorer and DOS on Win NT v4.0.

Created a few others and arranged by name in Win Exp and /O:N in DOS. Leads me to believe that the hyphen "-" is being stripped by the sort service (if you remove the hyphen from the file name, the sort makes sense).
Underlying reason is: Microsoft knows best and ... This is most likely a 'feature'.

lo

A2c#a-a-.tif A2c#aa.tif
A2c$a-a-.tif A2c$aa.tif
A2c@a-a-.tif A2c@aa.tif
A2c_a-a-.tif A2c_aa.tif
A2c---a-.tif A2ca.tif
A2c--aa-.tif A2caa.tif
A2c-a-a-.tif A2caa.tif
A2c-a--a-.tif A2caa.tif
A2c--a-a-a.tif A2caaa.tif
A2c--a-c.tif A2cac.tif
A2c---b-.tif A2cb.tif
A2c---b1.tif A2cb1.tif
A2c--bb-.tif A2cbb.tif
A2c---c-.tif A2cc.tif
A2c--cc-.tif A2ccc.tif

by kdean

Microsoft does not always know best. In the DOS window of 98 the directory is sorted using the ASCII codes, in Windows 98 Explorer I am unsure what is used to determine the sort. As to NT both the Command propmt and Explorer sort the same way.

by maxwell edison

Greetings,

To get around that difference you may want to consider a Directory Utilities for DOS.

Cut and paste this link (REMOVE any SPACES)

http://www.dosbin.com/dir1.htm

CSAP can sort disk directories and files by name, extension, date, or size. CSAP actually modifies the FAT order on disk. Many defragment utilities also offer FAT sorting during defragging but CSAP is obviously much quicker. By default, CSAP sorts files alphanumerically (e.g., if you run DIR without a switch on a Csap sorted directory, you'll notice that the file listing will display in alphanumeric order). CSAP has options to sort by extension, size, etc., and can also reverse sort. I sort my directories on a frequent schedule and often find it handy to havefiles arranged in a certain order for batch processing. CSAP should not be executed in a secondary shell (i.e., Windows). Perhaps better classified as a disk utility.

USAGE: CSAP [options] [directory_name]

-F "Freeze". Do not sort except for subdirectory entries and deleted files.

-N Sort on entry Name and Extension (the default).

-E Sort on entry Extension then Name.

-D Sort on entry Date/Time.

-S Sort on entry Size

-I Invert the sort order, i.e sort in descending order.
-L Sort only one level of the hierarchy.

-R Report the number of removed "deleted"entries and the sector addresses of the directory.

-P Do not remove "deleted" entries [reversed from SAP].

-V Verify (request permission from the operator) before sorting each directory.

-T Truncate directories, i.e. return unused disk space to the free space pool.

-Z Zero out unused entries (leading zero byte).

Regards,

Maxwell

by estebandelatorre

Double check Upper and Lower cases, while in dos, A=a under windows the have different sort order. You can modify windows order from control panel / regional settings.

This discussion is closed to new replies.