Option Compare Database Option Private Module Option Explicit Private Declare Function PathIsRelative Lib "Shlwapi" _ Alias "PathIsRelativeA" (ByVal path As String) As Long Public Enum EMakeDirStatus ErrSuccess = 0 ErrRelativePath ErrInvalidPathSpecification ErrDirectoryCreateError ErrSpecIsFileName ErrInvalidCharactersInPath End Enum Const MAX_PATH = 260 ' Create folder `Path`. Silently do nothing if it already exists. Public Sub MkDirIfNotExist(ByVal path As String) On Error GoTo MkDirIfNotexist_noop MkDir path logger "MkDirIfNotExist", "INFO", "New dir created: " & path MkDirIfNotexist_noop: On Error GoTo 0 End Sub ' Delete a file if it exists. Public Sub DelIfExist(ByVal path As String) On Error GoTo DelIfNotExist_Noop Kill path 'logger "DelIfExist", "DEBUG", "Killed: " & path DelIfNotExist_Noop: On Error GoTo 0 End Sub Public Function DirExists(ByVal strPath As String) As Boolean On Error Resume Next DirExists = False DirExists = ((GetAttr(strPath) And vbDirectory) = vbDirectory) End Function Public Function FileExists(ByVal strPath As String) As Boolean On Error Resume Next FileExists = False FileExists = ((GetAttr(strPath) And vbDirectory) <> vbDirectory) End Function