Int 21H [2.0] Function 3AH (58) Delete directory

Removes a directory using the specified drive and path.

Call with:

AH = 3AH

DS:DX = segment:offset of ASCIIZ pathname

Returns:

If function successful

Carry flag = clear

If function unsuccessful

Carry flag = set

AX = error code

Note:

The function fails if:

any element of the pathname does not exist.

the specified directory is also the current directory.

the specified directory contains any files.

[3.0+] the program is running on a network and the user running the program has insufficient access rights.

Example:

Remove the directory named MYSUB in the root directory on drive C.

dname db 'C:\MYSUB',0

.

.

.

mov ah,3ah ; function number

mov dx,seg dname ; address of pathname

mov ds,dx

mov dx,offset dname

int 21h ; transfer to MS-DOS

jc error ; jump if delete failed

.

.

.