Gervase Markham: Top 50 DOS Problems Solved: Sorting Directory Listings |
Q: Could you tell me if it’s possible to make the DIR command list files in alphabetical order?
A: Earlier versions of DOS didn’t allow this but there’s a way round it. MS-DOS 5 gives you an /ON switch to use with DIR, for instance:
DIR *.TXT /ON /P
would list all the files with names ending in .TXT, pause the listing every screenful (/P) and sort the names into alphabetical order (/ON).
…
Users of earlier DOS programs can shove the output from DIR through a utility program that sorts the listing before printing it on the screen. That utility is SORT.EXE, supplied with DOS. … [So:]
DIR | SORT
diverts the output from DIR into SORT, which sorts the directory listing and sends it to the screen. Put this in a batch file called SDIR.BAT and you will have a sorted directory command called SDIR.
I guess earlier versions of DIR followed the Unix philosophy of “do one thing”…
http://feedproxy.google.com/~r/HackingForChrist/~3/3h3YSF51Kc0/
Комментировать | « Пред. запись — К дневнику — След. запись » | Страницы: [1] [Новые] |