What can be created, can also be destroyed. The rmdir() "Remove Directory" API is used to delete a directory.
Here are the C and RPG prototypes for the rmdir() API.
int rmdir(const char *path) D rmdir PR 10I 0 ExtProc('rmdir') D path * value options(*string)
In order for a directory to be deleted, it must be empty. You cannot delete a directory that still has files in it.
Here's a sample of deleting the ShoeTongue directory:
c if rmdir('/ifstest/ShoeTongue') < 0 c callp EscErrno(errno) c endif