DIRECTORY
BASIC keyword | |
Keyword: | DIRECTORY (or for BASIC 7.0: CATALOG) |
Abbreviation: | DI Shift+R (or for BASIC 7.0: C Shift+A) |
Type: | Command |
Token code: | BASIC 4.0: 218/$DA BASIC 3.5 and 7.0: 238/$EE |
Handling routine in BASIC ROM: |
BASIC 3.5: 51388–51520 $C8BC –$C940 BASIC 7.0: 41086–41244 $A07E–$A11C |
List of all BASIC keywords |
Remark: This article describes the BASIC command DIRECTORY in Commodore BASIC V3.5 or higher.
Type: Command General Programming-Syntax: DIRECTORY [<filename>] [,D<drive number>] [[,]ON U<device number>]
DIRECTORY is a BASIC 3.5 command that displays the contents of a disk on the screen. It can not be used to print out the directory.Use CTRL +S to pause the display (any other key resumes it) and use the Commodore key to slow it down.
The optional parameter <filename> may contain wildcards or a file type selector to filter the output, showing only the corresponding matches.
Examples[edit | edit source]
Lists all files on the disk:
DIRECTORY
Tries to list a file named "TEST" if it exists on unit 9 (8 is default), drive 0:
DIRECTORY D0,U9,"TEST"
Lists all files starting with an "A" (using wildcard character "*"):
DIRECTORY "A*"
Lists files with filename of length 6, any last character:
DIRECTORY D0,"TEST1?"
The "?" is used as a wildcard that can match any character in that position. Possible results may include "TEST10", "TEST15", "TEST1B"
With variable parameters:
D$="*=S": GA=8 DIRECTORY (D$),U(GA)
To print the directory out
(Uses printer device #4)
LOAD"$",8 OPEN4,4:CMD4:LIST PRINT#4:CLOSE4
ABS | ASC | ATN | AUTO | BACKUP | BOX | CHAR | CHR$ | CIRCLE | CLOSE | CLR | CMD | COLLECT | COLOR | CONT | COPY | COS | DATA | DEC | DEF | DELETE | DIM | DIRECTORY | DLOAD | DO | DRAW | DS | DS$ | DSAVE | END | EL | ELSE | ER | ERR$ | EXIT | EXP | FN | FOR | FRE | GET | GET# | GETKEY | GOSUB | GOTO | GRAPHIC | GSHAPE | HEADER | HELP | HEX$ | IF | INPUT | INPUT# | INSTR | INT | JOY | KEY | LEFT$ | LEN | LET | LIST | LOAD | LOCATE | LOG | LOOP | MID$ | MONITOR | NEW | NEXT | ON | OPEN | PAINT | PEEK | POKE | POS | PRINT | PRINT USING | PRINT# | PUDEF | RCLR | RDOT | READ | REM | RENAME | RENUMBER | RESTORE | RESUME | RETURN | RGR | RIGHT$ | RLUM | RND | RUN | SAVE | SCALE | SCNCLR | SCRATCH | SGN | SIN | SOUND | SPC | SQR | SSHAPE | STOP | STR$ | SYS | TAB | TAN | TRAP | TROFF | TRON | UNTIL | USR | VAL | VERIFY | VOL | WHILE | WAIT