' =============================================================
' function: FolderCopy
' desc : Copys 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 FolderCopy(strSourceFolder, strDestinationFolder)
Dim objFS
' create a file system object
Set objFS = CreateObject("Scripting.FileSystemObject")
' check that the source folder exists
If Not objFS.FolderExists(strSourceFolder) Then
' fail if the source does not exist
reporter.ReportEvent micFail, "Copy Folder", "Source Folder '"& strSourceFolder &"' Does Not Exist"
Else
' create the destination folder if it doesn't already exist
If Not objFS.FolderExists(strDestinationFolder) Then
objFS.CreateFolder(strDestinationFolder)
End If
' copy the folder
objFS.CopyFolder strSourceFolder, strDestinationFolder
End If
' destroy the object
Set objFS = Nothing
End Function 'FolderCopy
0 comments:
Post a Comment