QTP code - Delete Folder











Sponsored Links:


Delete a local or network folder.
.
.
.
.
.
.
.
.
.
.
.
' =============================================================

' function: FolderDelete
' desc : Deletes a folder and all of it's contents
' params : strFolder - the folder to delete
' returns : void
' =============================================================

Function FolderDelete(strFolder)

Dim objFS

' create a file system object
Set objFS = CreateObject("Scripting.FileSystemObject")

' check that the source folder exists
If Not objFS.FolderExists(strFolder) Then

    ' fail if the source does not exist
    reporter.ReportEvent micFail, "Delete Folder""Unable to Delete Folder '"& strFolder &"', It Does Not Exist"

Else

    ' delete the folder
    objFS.DeleteFolder strFolder

End If

' destroy the object
Set objFS = Nothing

End Function 'FolderDelete

0 comments: