Classic Computer Magazine Archive COMPUTE! ISSUE 74 / JULY 1986 / PAGE 96

Apple ProDOS Catalog Sorter

William J Coohon

Here's a short utility program that helps you organize your floppy disks by displaying or printing sorted directories. It works on any Apple Il-series computer with ProDOS.

Sometimes, locating a particular program or file within a large collection of disks is like searching for a contact lens in a bowl of water-- especially when any list of your disk directories will inevitably be outdated and in no particular order. "ProDOS Catalog Sorter" helps you eliminate the confusion by sorting ProDOS directories and listing them on your monitor or printer.

Type in the program below and save a copy before running it for the first time. There are two options to consider when typing Catalog Sorter: date and time stamping, and printer set-up. Stamping the date and time on listings is extremely useful for keeping track of how current (or how old) the information is. If your Apple doesn't have a clock, you may remove certain lines from Catalog Sorter or use the date/time-setting program found in the "Reader's Feedback" column in November, 1985 COMPUTE!. Without the date and time, the program prints zeros. To remove this feature, delete lines 280-320, 345, 445, and 780.

You can also determine how your printer should generate hardcopies of the sorted directories. My directory listings are printed at 17 characters per inch with 8 lines per inch spacing. That way, they can be trimmed down to fit neatly inside a disk envelope or storage case. The printer control characters for an Apple Imagewriter are set up in line 440. If you want to substitute your own printer options, simply alter these codes. If you want your printer to use its defaults, delete line 440 completely. The variable P in line 440 is set to a value of 1 to allow the program to reset the printer options later in line 560, which may also have to be altered for other printer control characters,

Sorting Directories

When you run the program, Catalog Sorter prompts you for drive number 1 or 2 (to exit the program at this stage, simply enter 0). Next, you are asked whether you want the directories sorted. Type N to disable sorting; any other response sorts your directories in alphabetical order. When might you want to disable sorting? Sometimes programs or files are grouped under directories logically, according to their respective functions. But other files--for instance, monthly financial data--might be organized chronologically. Sorting such files alphabetically would make the grouping less meaningful.

After reading the disk directory, the program asks if you wish to view the listing on your screen or route the output to your printer. It tells you which directory is being sorted (if you choose to sort), then prints the list and moves on to the next directory (if any others exist). Multiple directories are read, sorted, and listed separately to maintain the order of the directory hierarchy. The bottom line of the directory list indicates how many disk blocks are free, how many are used, and the total available (see figure). When all directories on a disk are read, sorted, and listed, the program gives you the option to quit or repeat the process.

If the directory list is displayed on the screen, it appears in the same format as if you typed ProDOS CATALOG command--in 80 columns (note that the abbreviated CAT command uses a 40-column format). This is rather difficult to read on a 40-column display, so an 80-column screen is recommended unless you're interested mainly in the hardcopy listings. Line 260 sets up S$ to switch to the 80-column screen, assuming that the 80-column hardware is addressed at slot 3 (the normal slot for the IIe and IIc). If you wish, you can modify Catalog Sorter to display only 40 columns on each line: Change the PR#3 in line 260 to PR#0.

A sample directory listed generated with "ProDOS Catalog Sorter."

DATE: 12/30/85	 TIME: 19:00

/COOHON.30DEC85

 NAME            TYPE  BLOCKS  MODIFIED         CREATED           ENDFILE  SUBTYPE

*BASIC.SYSTEM     SYS      21  {NO DATE}         8-DEC-85 22:00     10240
 CAT.SORT         BAS       5  30-DEC-85 18:30  30-DEC-85 18:30      1566
 CAT.SORT.COPY2   BAS       5  30-DEC-85 18:30  30-DEC-85 18:30      1566
 CAT.SORT.TEXT    TXT       8  30-DEC-85 19:00  30-DEC-85 19:00      3546  R= 0
*PRODOS           SYS      31  {NO DATE}         8-DEC-85 22:00     15360

BLOCKS FREE: 203      BLOCKS USED: 77     TOTAL BLOCKS: 280         FILES: 5