Determines whether a file exists on the specified path.
[Visual Basic] Public Shared Function FileExists( _ ByVal path As String _ ) As Boolean [C#] public static bool FileExists( string path ); [C++] public: static bool FileExists( String* path ); [JScript] public static function FileExists( path : String ) : Boolean;
true if the file given by the specified path exists, false if the file does not exist or if path specifies a directory.
Exception Type | Condition |
---|---|
ArgumentException | path is the empty string ("") or contains only whitespaces. |
ArgumentNullException | path is null. |
IOException | path is invalid or an I/O error occurs (for example, a disk error). |
SecurityException | The caller does not have the required permission. |
path can be either relative or absolute. A relative file path will be fully qualified based upon the current directory and drive.
If path describes a directory, this method returns false.
NGWS Runtime Security:
FileIOPermissionAccess | Read permission for the target directory. |