Function 3Ah Remove Directory

mov dx, seg Dir

mov ds, dx

mov dx, offset Dir ;ds:dx points to name of directory to remove

mov ah, 3Ah ;Remove Directory

int 21h

jc error_handler ;carry set means error

Remove Directory (Function 3Ah) removes (deletes) a specified directory.

Parameter

Dir

Points to a zero-terminated ASCII string that specifies the directory to remove. This string must be a valid MS-DOS directory name and cannot contain wildcards.

Return Value

If the function is successful, the carry flag is clear. Otherwise, the carry flag is set and the AX register contains an error value, which may be one of the following values:

Value Name

0003h ERROR_PATH_NOT_FOUND
0005h ERROR_ACCESS_DENIED
0010h ERROR_CURRENT_DIRECTORY

Comment

This function returns 0005h (ERROR_ACCESS_DENIED) if the directory to be deleted is not empty or the directory to be deleted is the root directory.

See Also

Function 39h Create Directory
Function 3Bh Change Current Directory
Function 47h Get Current Directory