Int 21H [1.0] Function 13H (19) Delete file

Deletes all matching files from the current directory on the default or specified disk drive.

Call with:

AH = 13H

DS:DX = segment:offset of file control block

Returns:

If function successful (file or files deleted)

AL = 00H

If function unsuccessful (no matching files were found, or at least one matching file was read-only)

AL = FFH

Notes:

The wildcard character ? is allowed in the filename; if ? is present and there is more than one matching filename, all matching files will be deleted.

[2.0+] Int 21H Function 41H, which allows full access to the hierarchical directory structure, should be used in preference to this function.

[3.0+] If the program is running on a network, the user must have Create rights to the directory containing the file to be deleted.

Example:

Delete the file MYFILE.DAT from the current disk drive and directory.

myfcb db 0 ; drive = default

db 'MYFILE ' ; filename, 8 chars

db 'DAT' ; extension, 3 chars

db 25 dup (0) ; remainder of FCB

.

.

.

mov ah,13h ; function number

mov dx,seg myfcb ; address of FCB

mov ds,dx

mov dx,offset myfcb

int 21h ; transfer to MS-DOS

or al,al ; check status

jnz error ; jump, delete failed

.

.

.