Delete(Path: String; Recursive: Boolean);
Path - directory that must be deleted.
Recursive - parameter that determines whether the specified directory is deleted together with subdirectories and files. Pass True as a parameter value to delete a directory with all its contents. The False value is used to delete an empty directory.
The Delete method deletes the specified directory.
If the specified directory does not exist, an exception is thrown.
If False is passed as the Recursive value and the specified directory contains subdirectories and files, an exception is thrown.
Sub UserProc(sPath: String);
Begin
If Directory.Exists(sPath) Then
Directory.Delete(sPath, True);
End If;
End Sub UserProc;
On executing the example it is checked if the directory specified in the sPath parameter is present in the file system. If the directory exists, it is deleted with all its contents.
See also: