# Function Reference

# FileExists

Checks if a file or directory exists.

FileExists ( "path" )

## Parameters

Path | The directory or file to check.

## Return Value

Success: | 1.
Failure: | 0 if path/file does not exist.

## Remarks

FileExists() returns 0 if you specify a floppy drive which does not contain a disk.
If you are running in X86 mode (@AutoItX64 = 0) under a Windows running in X64 mode (@OSArch = "X64") and you want to access @WindowsDir\System32, X64 files will not be found. So you can use @WindowsDir\Sysnative.

## Related

DriveStatus, FileGetAttrib

## Example

    #include <MsgBoxConstants.au3>
    #include <WinAPIFiles.au3>

    Example()

    Func Example()
        ; Create a constant variable in Local scope of the filepath that will be read/written to.
        Local Const $sFilePath = _WinAPI_GetTempFileName(@TempDir)

        Local $iFileExists = FileExists($sFilePath)

        ; Display a message of whether the file exists or not.
        If $iFileExists Then
            MsgBox($MB_SYSTEMMODAL, "", "The file exists." & @CRLF & "FileExist returned: " & $iFileExists)
        Else
            MsgBox($MB_SYSTEMMODAL, "", "The file doesn't exist." & @CRLF & "FileExist returned: " & $iFileExists)
        EndIf

        ; Delete the temporary file.
        FileDelete($sFilePath)
    EndFunc   ;==>Example