IDirectory.Delete

Syntax

Delete(Path: String; Recursive: Boolean);

Parameters

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.

Description

The Delete method deletes the specified directory.

Comments

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.

Example

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:

IDirectory