SCRATCH

From C64-Wiki
Jump to: navigation, search
BASIC keyword
Keyword: SCRATCH
Abbreviation: SC Shift+R
Type: Command
Token code: 242/$F2
Handling routine
in BASIC ROM:
BASIC 3.5:
51674–51699
$C99C–$C9F3
BASIC 7.0:
41798–41825
$A2A1–$A2D6
List of all BASIC keywords


Remark: This article describes the BASIC command SCRATCH in Commodore BASIC V3.5 or higher.

Type: Command
General Programming-Syntax: SCRATCH <filename> [,D<drive number>] [[,]ON U<device number>]

SCRATCH is a BASIC 3.5 command that is used to delete files on a diskette.
The filename parameter may consists of multiple filenames separated by a comma (string is limited to 16 characters) which may also contain wildcard characters or a file type selector.
In direct mode the action is preceded by an interactive request for acknowledgment:

ARE YOU SURE?

Any input not starting with "Y" aborts the command.
Also in direct mode the disk error status shows how many files actually has been deleted.

Examples[edit]

Removes file "GAME 1" from the disk in drive 0 of floppy device 8:

SCRATCH "GAME 1"

Tries to remove two files (if existing):

SCRATCH "GAME,SCORE"

Tries to remove file "UTIL" and all files with name length of one, but only of sequential type:

SCRATCH "UTIL,?=S"

Removes file "BAD-GAME" from disk on drive 1 of an dual-drive floppy addressed as device 9:

SCRATCH "BAD-GAME", D1, U9

Same as the previous but with alternative parameter syntax:

SCRATCH "BAD-GAME" ON U9,D1

Removes all files starting with "DATA-198" of any ending (match all wildcard "*") on device 11 (implicitly drive 0):

SCRATCH "DATA-198*",U11


BASIC V3.5 Commands

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 | DSAVE | END | ERR$ | 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 | 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 | USR | VAL | VERIFY | VOL | WAIT