# IfExist / IfNotExist

Checks for the existence of a file or folder.

    IfExist, FilePattern
    IfNotExist, FilePattern
    AttributeString := FileExist(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

    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.