Site icon EfmSoft

What does NTSTATUS 0xC0000101 (STATUS_DIRECTORY_NOT_EMPTY) mean?

 
Previous Next
STATUS_VARIABLE_NOT_FOUND STATUS_FILE_CORRUPT_ERROR

STATUS_DIRECTORY_NOT_EMPTY

STATUS_DIRECTORY_NOT_EMPTY is returned when a delete operation targets a directory that still contains entries. Removing a directory is not the same as recursively deleting a tree: the directory must be empty before the final removal can succeed.

What “empty” requires

The caller must account for ordinary files and child directories, but also for concurrent activity. Another process can create a new entry between enumeration and deletion, and a handle can keep a directory in use while cleanup is still in progress. Windows documents that a directory removal is completed when the relevant handles are closed, so lifecycle and sharing rules can matter as well as the visible contents.

Reliable cleanup strategy

For user-facing cleanup, distinguish a real content problem from an access or sharing problem. A directory that cannot be removed because it is non-empty requires different remediation than one blocked by permissions or an incompatible open handle.

See Creating and Deleting Directories and RemoveDirectory.


Looking for a different code? Search another status or error code.

Exit mobile version