Checks if the specified directory exists.
f? = DirExist( Path$ [, fCreate?])
f, fCreate | : boolean expression |
Path$ | : string expression |
DirExist verifies that the directory in Path$ exists. It returns True if the path is a valid directory, or False otherwise. When the directory doesn't exist and the optional parameter fCreate is True the directory is created. When the creation fails, the return value is False.
$Library "gfawinx"
Debug.Show
Trace DirExist("C:\")
Trace DirExist("C:\tmp")
Trace DirExist("\\surface4\develop")
Trace DirExist("C:\tmp\ok3", True)
DirExist uses PathIsDirectory() API from shlwapi.dll, which does a better job than GetAttr, it can check for directories that GetAttr doesn't detect.
{Created by Sjouke Hamstra; Last updated: 24/08/2021 by James Gaite}