Function Reference

FileExists

Checks if a file or directory exists.

FileExists ( "path" )

 

Parameters

Path The directory or file to check.

 

Return Value

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

 

Remarks

FileExists returns 0 if you specify a floppy drive which does not contain a disk.

 

Related

FileGetAttrib, DriveStatus

 

Example


If FileExists("C:\autoexec.bat") Then
    MsgBox(4096, "C:\autoexec.bat File", "Exists")
Else
    MsgBox(4096,"C:\autoexec.bat File", "Does NOT exists")
EndIf

If FileExists("C:\") Then
    MsgBox(4096, "C:\ Dir ", "Exists")
Else
    MsgBox(4096,"C:\ Dir" , "Does NOT exists")
EndIf

If FileExists("D:") Then
    MsgBox(4096, "D: Drive", "Exists")
Else
    MsgBox(4096,"D: Drive", "Does NOT exists")
EndIf