Thursday, August 7, 2008

How to create a folder and delete a folder

folderPath="d:\Sample Folder"

Set fileSysObj=createobject("Scripting.FileSystemObject")

On Error resume next

fileSysObj.createfolder(folderPath)

If Err.number<> 0 Then
reporter.ReportEvent micFail,"createfolder","Unable to create the specified folder"
End If

If fileSysObj.folderexists(folderPath) Then
fileSysObj.deletefolder(folderPath)
else
reporter.ReportEvent micFail,"folder delete","The specified folder does not exist"
End If

No comments: