08-05-2008, 01:54 PM
Hi,
I need to move a file from one location to another
the below mentioned is the script
:
Move a file from one location to another.
-----------------------------------------------
Here where i need to mention the Source fiel and target file
Source file :a
Target file :b
I need to move a file from one location to another
the below mentioned is the script
:
Move a file from one location to another.
-----------------------------------------------
Code:
'function: FileMove
'desc : Moves a file from one location to another
' params : strFile - full path to the source file
' strTarget - the folder to move the file to
' returns : void
' ------------------------------------
Function FileMove(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 Move 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
' move the file
objFS.MoveFile strFile, strTarget
End If
' destroy the object
Set objFS = Nothing
End Function 'FileMove
Here where i need to mention the Source fiel and target file
Source file :a
Target file :b