Function 13h Delete File with FCB

mov dx, seg FileFCB

mov ds, dx

mov dx, offset FileFCB ;ds:dx points to FCB

mov ah, 13h ;Delete File with FCB

int 21h

cmp al, 0 ;zero means success

jne error_handler

Delete File with FCB (Function 13h) deletes the file or files identified by the file control block (FCB).

This function has been superseded by Delete File (Function 41h).

Parameter

FileFCB

Points to an FCB structure that identifies the file or files to delete. The fcbDriveId, fcbFileName, and fcbExtent fields must specify the filename and drive. The filename can include wildcards. All other fields must be zero. The FCB structure has the following form:

FCB STRUC

fcbDriveID db ? ;drive no. (0=default, 1=A, etc.)

fcbFileName db '????????' ;filename

fcbExtent db '???' ;file extension

fcbCurBlockNo dw ? ;current block number

fcbRecSize dw ? ;record size

fcbFileSize db 4 dup (?) ;size of file in bytes

fcbFileDate dw ? ;date file last modified

fcbFileTime dw ? ;time file last modified

fcbReserved db 8 dup (?) ;reserved

fcbCurRecNo db ? ;current record number

fcbRandomRecNo db 4 dup (?) ;random record number

FCB ENDS

For a full description of the FCB structure, see Chapter 3, “File System.”

Return Value

If a file matching the name in the FCB structure is found and deleted, the AL register contains 00h. Otherwise (if a matching file cannot be found), the AL register contains 0FFh.

Comments

Programs should not delete open files.

If the filename in the FCB structure contains wildcards, all matching files are deleted.

This function can be used to delete files on a network drive but only if the network has granted delete (or similar) access to the given file or drive.

See Also

Function 41h Delete File