Visit Mozilla.org

XPInstall API Reference:File Object:Methods:exists

From MDC

Contents

[edit] exists

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

[edit] Method of

File object

[edit] Syntax

boolean exists( FileSpecObject target )

[edit] Parameters

The exists method has the following parameters:

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

[edit] Returns

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

[edit] Example

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