'this function returns true if the path exists, false if not Public Function FolderExists(ByVal strPath As String) As Boolean Dim s As String 'strip final slash from path If Right(strPath, 1) = "\" Then strPath = Left(strPath, Len(strPath) - 1) 'check if directory exists s = Dir(strPath, vbDirectory) If s <> "" Then FolderExists = True End Function 'this function returns true if the directory is empty: 'this means that the directory only contains "." and ".." system directories Public Function IsFolderEmpty(ByVal strPath As String) As Boolean Dim s As String 'add final slash from path If Right(strPath, 1) <> "\" Then strPath = strPath & "\" 'check directory contents (files and subfolders) s = Dir(strPath, vbNormal Or vbDirectory) IsFolderEmpty = True Do While s <> "" 'if the directory contains something other than system folders 'then it's not empty If s <> "." And s <> ".." Then IsFolderEmpty = False Exit Do End If 'continue enum s = Dir Loop End Function