Creating and Deleting Directories

An application can programmatically create and delete directories.

To create a new directory, use the CreateDirectory, CreateDirectoryEx, or CreateDirectoryTransacted function. A directory is given the name specified when it is created. The conventions for naming a directory follow the conventions for naming a file. For a description of these conventions, see Naming a File.

To delete an existing directory, use the RemoveDirectory or RemoveDirectoryTransacted function. Before removing a directory, you must ensure that the directory is empty and that you have the delete access privilege for the directory. To do the latter, call the GetSecurityInfo function.