testing to see if a Directory exists

DBinPhilly

Registered User.
Local time
Today, 03:17
Joined
May 21, 2013
Messages
42
I'm starting to automatically save PDF copies of certain reports in predetermined locations. I need to copy a file to a particular directory (based upon various criteria), but if the directory does not exist, I want to create the directory on the fly first. Otherwise I will just proceed with the copy.

I'm sure there is a DOS command to do this, but I can't find it.

Your help would be gratefully appreciated.
 
fBackup = BPath & "\Backup"

If FolderExists(fBackup) = False Then
MkDir fBackup
End If

Function FolderExists(strPath As String) As Boolean
On Error Resume Next
FolderExists = ((GetAttr(strPath) And vbDirectory) = vbDirectory)
End Function
 
thanks. the method works as advertised and I'm on to the next problem
 

Users who are viewing this thread

Back
Top Bottom