void DeleteDirectory( string folder, bool recursive )

robot_2Generated
code_blocksInput

Description

The DeleteDirectory method is used to delete a directory from the file system. This method can delete directories recursively if specified.

Usage

To use the DeleteDirectory method, provide the path to the directory you wish to delete as a string. Set the recursive parameter to true if you want to delete all subdirectories and files within the specified directory. If recursive is set to false, the directory must be empty to be deleted.

Example

BaseFileSystem fileSystem = new BaseFileSystem();

// Delete a directory and all its contents
fileSystem.DeleteDirectory("/path/to/directory", true);

// Delete an empty directory
fileSystem.DeleteDirectory("/path/to/emptydirectory", false);