Problem:
CBL_DELETE_DIR only deletes empty directory by design. How to delete a directory with the files within then?
Resolution:
You always may delete file by file using CBL_DELETE_FILE or any other methods before using CBL_DELETE_DIR.
A quick way to do this is to execute RMDIR or RD command in a x'91' function 35 (or in a WinAPI function CreateProcess). RMDIR and RD stand for Remove Directory.
Here is a code using the RD command (RMDIR = RD):
$set defaultbyte(00)
identification division.
program-id. x91fn35.
working-storage section.
1 x pic x.
1 result pic x comp-x.
1 function-code pic x comp-x value 35.
1 parameter.
2 name-len pic x comp-x value 19.
2 progname pic x(19).
procedure division.
display 'First create c:\\temp999'
display space
display 'Press any key to continue. . .' no advancing
accept x
display 'Deleting c:\\temp999'
move 'rd c:\\temp999 /s /q' to progname
call x'91' using result, function-code, parameter
display 'return code: ' result
if result = zero
display 'c:\\temp999 deleted successfully'
else
display 'Failed to delete c:\\temp999'
end-if
goback
.