|Token code:||BASIC 4.0:|
BASIC 3.5 and 7.0:
in BASIC ROM:
|BASIC 3.5: |
|List of all BASIC keywords|
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.
In direct mode the disk error status (also provided in system variable DS$) shows how many files actually have been deleted (by means of the track value). Because the track number is limited to 2 digits, values greater than 99 will get cut off at the hundreds. Even though 100 files have been scratched the result became 00 which makes it impossible to determine the actual count of deleted files for all cases.
Examples[edit | edit source]
Removes file "GAME 1" from the disk in drive 0 of floppy device 8:
SCRATCH "GAME 1"
Tries to remove two files (if existing):
Tries to remove file "UTIL" and all files with name length of one, but only of sequential type:
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):
Using variables (the command is executed without a acknowledgement question):
100 MASK$="SCR*" 110 DRIVE=0 120 DEV=8 130 SCRATCH (MASK$),D(DRIVE),U(DEV): PRINT "Status: ";DS$