Starting with a path to some directory, determine whether the directory is empty.

An empty directory contains no files nor subdirectories.
With Unix or Windows systems, every directory contains an entry for “.” and almost every directory contains “..” (except for a root directory); an empty directory contains no other entries.

; this routine attempts to remove the directory and returns an error code if it cannot.
 
mov ax,seg dirname           ;load into AX the segment where dirname is stored.
mov ds,ax                    ;load the segment register DS with the segment of dirname
mov dx,offset dirname        ;load into DX the offset of dirname
mov ah,39h                   ;0x39 is the interrupt code for remove directory
int 21h                      ;sets carry if error is encountered. error code will be in AX. 
                             ;If carry is clear the remove was successful
 
jc error
 
mov ah,4Ch	;return function
mov al,0	;required return code
int 21h         ;return to DOS
 
error:          ;put your error handler here
 
mov ah,4Ch	;return function
mov al,0	;required return code
int 21h         ;return to DOS
 
 
dirname    db "GAMES",0