Make Directory





3
Date Submitted Thu. Mar. 2nd, 2006 10:32 AM
Revision 1 of 1
Syntax Master dannyboy
Tags Directory | Folder | MAKE | MD | VBSCRIPT
Comments 1 comments
Make a new directory

Function MD(strDirName)
     Dim lFSObj, lFolder
     ' First See if it already exists
     set lFSObj = Wscript.CreateObject("Scripting.FileSystemObject")
     set lFolder = lFSObj.GetFolder(strDirName)
     If Err.number = 0 then
        '
Yes, it does exist so we don't have to do anything
        MD = True
     Else
        Err.Clear
        lFSObj.CreateFolder(strDirName)
        If Err.Number <> 0 Then
          MD = False
        Else
          MD = True
        End If
     End If
     Set lFolder = Nothing
     Set lFSObj = Nothing
End Function

 

Comments

Comments Errors shouldn't be used
Sat. Sep. 9th, 2006 9:32 PM    Helper jbplou

Voting