' ============================================================= Dim objFS ' create a file system object ' check that the source folder exists ' fail if the source does not exist Else ' check that the destination folder doesn't already exist Else ' fail if the target folder was already in place ' destroy the object
' function: FolderMove
' desc : Moves a folder and all of its files to a new path
' params : strSourceFolder - the folder to copy
' strDestinationFolder - the location to copy to
' returns : void
' =============================================================
Function FolderMove(strSourceFolder, strDestinationFolder)
Set objFS = CreateObject("Scripting.FileSystemObject")
If Not objFS.FolderExists(strSourceFolder) Then
reporter.ReportEvent micFail, "Move Folder", "Source Folder '"& strSourceFolder &"' Does Not Exist"
If Not objFS.FolderExists(strDestinationFolder) Then
' move the folder
objFS.MoveFolder strSourceFolder, strDestinationFolder
reporter.ReportEvent micFail, "Move Folder", "Unable to Move Folder as the Target '" & strDestinationFolder & "' Already Exists"
End If
End If
Set objFS = Nothing
End Function 'FolderMove
Wednesday, 19 October 2011
QTP Script: Move a local or network folder
08:09
No comments
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment