' =============================================================
' function: FileCopy
' desc : Copies a file from one location to another
' params : strFile - full path to the source file
' strTarget - the folder to copy the file to
' returns : void
' =============================================================
Function FileCopy(strFile, strTarget)
Dim objFS
' create a file system object
Set objFS = CreateObject("Scripting.FileSystemObject")
' check that the source file exists
If Not objFS.FileExists(strFile) Then
' fail if the source does not exist
reporter.ReportEvent micFail, "Move File", "Unable to Copy the File '"& strFile &"', It Does Not Exist"
Else
' create the destination folder if it doesn't already exist
If Not objFS.FolderExists(strTarget) Then
objFS.CreateFolder(strTarget)
End If
' copy the file
objFS.CopyFile strFile, strTarget
End If
' destroy the object
Set objFS = Nothing
End Function 'FileCopy
' function: FileCopy
' desc : Copies a file from one location to another
' params : strFile - full path to the source file
' strTarget - the folder to copy the file to
' returns : void
' =============================================================
Function FileCopy(strFile, strTarget)
Dim objFS
' create a file system object
Set objFS = CreateObject("Scripting.FileSystemObject")
' check that the source file exists
If Not objFS.FileExists(strFile) Then
' fail if the source does not exist
reporter.ReportEvent micFail, "Move File", "Unable to Copy the File '"& strFile &"', It Does Not Exist"
Else
' create the destination folder if it doesn't already exist
If Not objFS.FolderExists(strTarget) Then
objFS.CreateFolder(strTarget)
End If
' copy the file
objFS.CopyFile strFile, strTarget
End If
' destroy the object
Set objFS = Nothing
End Function 'FileCopy
0 comments:
Post a Comment