# If[Not]Exist

Checks for the existence of a file or folder.

Deprecated: These commands are not recommended for use in new scripts. Use the FileExist function instead.

    IfExist, FilePattern
    IfNotExist, FilePattern

## Parameters

FilePattern

  The path, filename, or file pattern to check. FilePattern is assumed to be in %A_WorkingDir% if an absolute path isn't specified.

## Related

FileExist(), Blocks, Else, File-loops

## Examples

#1

    IfExist, D:\
        MsgBox, The drive exists.
    IfExist, D:\Docs\*.txt
        MsgBox, At least one .txt file exists.
    IfNotExist, C:\Temp\FlagFile.txt
        MsgBox, The target file does not exist.