exists

exists

Returns a value indicating whether the specified file or directory exists.

Method of

File object

Syntax

boolean exists( FileSpecObject target )

Parameters

The exists method has the following parameters:

target
A FileSpecObject representing the file or directory being tested for existence.

Returns

A boolean value specifying whether the file or directory does indeed exist or does not.

Example

f = getFolder( "Program", "sample.txt" );
if ( File.exists(f) ) // do something with the file