Storages & Files Exists
Exists method 

Checks if file or a directory exists in the file system

Syntax:

variable = object.Exists(full_path_name)

Parameters:

full_path_name - The full path name of the file or directory you want to check.

returned values:
0 - does not exist (nor file nor directory)
-1 - The full_path_name parameter matches existing directory
1 - The full_path_name parameter matches existing file

Samples:

Set sf = Server.CreateObject("newObjects.utilctls.SFMain")
Select Case sf.Exists("C:\FileOrDir")
  Case -1
    Response.Write "<B>Error there is a directory with the name specified</B>"
  Case 1
    ' The file exists - use it ...
    ' ...
  Case 0
    ' No file exists - create new for example or do something else
End Select 

Remarks:

This is more universal function than FileExists or FolderExists and allows the application to check in turn if there is an object with a given name and what kind of object is it. While FileExists/FolderExists methods are provided mostly to simplify porting of existing applications that use FSO (FileSystemObject) this method is recommended for the new applications as it is more convenient.

Applies to: SFMain object

Supported on:

Windows 95/NT and later
Windows CE 3.0 and later
Pocket PC/Windows Mobile 2003 and later
Windows CE.NET 4 and later

 

newObjects Copyright 2001-2006 newObjects [ ]