Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check for/Create a folder 1

Status
Not open for further replies.

evalesthy

Programmer
Oct 27, 2000
513
US
I am sending a file to a backup location (in this instance a Zip Disk on D:). The process works fine using "FileCopy, strSource, strDest". However, what I would like to do is put the file in a specific folder (e.g. send 'Daily Backup' to folder named "Daily" on the Zip, etc.). What I don't know how to do is to check for the existence of the folder at the target destination and if it does not exist then create it. Help will be greatly appreciated.
 
You can check for the folder first by:

Dim myDir
myDir = Dir("D:\Daily", vbDirectory)

If myDir = "" Then
'Need to create Directory
MkDir ("D:\Daily")
End If

HTH
JC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top