IDirectory.Delete

Syntax

Delete(Path: String; Recursive: Boolean);

Parameters

Path - a directory that should be deleted.

Recursive - a parameter that determines whether a specified directory is deleted together with subdirectories and files. True should be passed as a parameter value to delete a directory with all its content. The False value is used to delete an empty directory.

Description

The Delete method deletes a specified directory.

Comments

If a specified directory does not exist, an exception is generated.

If False is passed as a parameter Recursive value and specified directory contains subdirectories and files, an exception is generated.

Example

Sub UserProc(sPath: String);
Begin
    If Directory.Exists(sPath) Then
        Directory.Delete(sPath, True);
    End If;
End Sub UserProc;

While executing this example it is checked whether directory, specified in the parameter sPath, is present in file system. If directory exists it is deleted with all its content.

See also:

IDirectory