FileFunctions.

Exists(string) Method

Summary

Determines whether the specified file exists.
Assembly
NAnt.Core.dll
Namespace
NAnt.Core.Functions
Containing Type
FileFunctions

Syntax

[Function("exists")]
public bool Exists(string file)

Examples

Execute a set of tasks, if file "output.xml" does not exist.

    <if test="${not file::exists('output.xml')}">
    ...
</if>

Attributes

Type Description
FunctionAttribute Indicates that the method should be exposed as a function in NAnt build files.

Parameters

Name Type Description
file string The file to check.

Return Value

Type Description
bool true if file refers to an existing file; otherwise, false.