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.
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.
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 |
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.
Function 39h Create Directory
Function 3Bh Change Current Directory
Function 47h Get Current Directory