I maintain a Windows 98SE machine for lots of reasons (Star Commander, SIO-2-PC, ADTPro, 3.5" and 5.25" PC Floppies, RS-232 port, Zip, Jazz, CD-ROM, Ethernet, etc). It is a very useful box.

I also tend to boot to a command prompt a lot on this box, but Windows 98SE uses MS-DOS version 7.1 which has some differences from MS-DOS 6.22.

Mostly this is no big deal, but I do miss the nice DEFRAG command (from MS-DOS 6.22) that would not only defragment your drive but also allow you to sort the directory structure alphabetically. This helped to soothe my file system OCD immensely.

I'm looking for a similar tool I can use from MS-DOS 7.1 (or Windows 98SE if need be) to sort my folders. I've checked the Windows 98 version of Defrag, but alas, it doesn't seem to allow for the nifty alpha sorting that was available in earlier versions.

I've considered trying to run the MS-DOS 6.22 version but suspect it will either complain about being the wrong version, or worse, screw up my filesystem. So..

Does anyone know of a command line tool or Windows 98 utility that will safely and reliably allow me to alpha-sort my directories?

  • 4
    Do you have evidence that your partitions access files most frequently in alphabetical order? The time that DIR spends sorting filenames in memory is far less than the mechanical access time of pulling in files alphabetically. Also, it's often slower to sort an already sorted list than a random one, so you may be making your computer less efficient than it could be by insisting on a sorted defrag. Defragging is a necessary thing on MS-DOS and is rewarded by better performance. Microsoft's removal of the sort option might have been to give better performance overall. – scruss Jun 21 '17 at 15:11
  • 5
    Just put set DIRCMD=/o in your AUTOEXEC.BAT file. – Ross Ridge Jun 21 '17 at 16:06
  • No, I do not have any reason to believe this will improve performance. I simply like being able to see things alphabetical in DOS based file picker dialogs. And (unless someone can tell me how) I cant seem to use DIR /OG and /ON at the same time. An already alphabetical folder means I can use DIR /OG and still get my files/folders grouped and alphabetical. I was only half-kidding when I said its an OCD thing... – Geo... Jun 21 '17 at 16:07
  • 2
    If you can find them, the old Norton Utilities (pre-Symantec borgation) included a ds tool that would, on any given directory, sort the directory entries. If you're using the "DOS" of Win98SE, though, it may not work; Win98SE was the first of the (consumer) Windows editions that wasn't built on DOS. (Win98 not SE was built on DOS - the last version that was essentially a supershell for DOS) – Jeff Zeitlin Jun 22 '17 at 11:44
  • 1
    It's not a good idea to physically sort the files in alphabetical order since you really want the frequently accessed ones at the head of the list. I wouldn't worry about the order on the disk as long as you can configure dir to list them in the right order. – JeremyP Jul 3 '17 at 15:13

The DEFRAG.EXE utility in DOS 6.22 probably won't work as you expect, as (1) it doesn't know anything about FAT32, and (2) it doesn't know anything about long file names, which means that it quite likely will trash your LFNs unless you back them up first.

Searching around, one of the pages referred to directory sort utilities for Windows that deal with FAT partitions. These may help as long as they are still Win95/98/Me-compatible: I make no guarantees about their reliability, and the usual cautions about mucking around with mounted filesystems applies.

As others have noted, sorting the physical directory structure may not be as useful as you think, because DOS makes no effort to keep the directories ordered. You'll have to run the sorting utility periodically to maintain sorted directories.

  • 1
    "it doesn't know anything about long file names, which means that it quite likely will trash your LFNs" Not just "quite likely"; it will trash your long file names, if any, and you'll be left with only the mangled 8+3 ones. I distinctly remember this being a major caveat when Windows 95 hit the market; it was pretty much "whatever you do, don't run disk utilities not updated to be compatible with Windows 95!" – a CVn Jan 4 '18 at 20:59
  • Welcome to Retrocomputing Stack Exchange. Thanks for sharing an answer! Rather than just providing links to data that could go away at any time, it is good if you can summarize the salient point of the link. Making the answer more self contained with references to your sources will also help you do well on Stack in general. You should probably add a disclaimer to the top that @MichaelKjörling is suggesting from one of the links. – Rowan Hawkins Jan 5 '18 at 1:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.