Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Moving a fiel from one location to another
#3
Solved: 12 Years, 10 Months, 4 Weeks ago
If i place tha also it is showing up an error like "expected identifier"

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("D:\ccc, D:\Target")

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
Reply


Messages In This Thread
RE: Moving a fiel from one location to another - by siri - 08-06-2008, 11:58 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to paste file location in QTP camillelola 0 1,938 08-09-2018, 10:54 AM
Last Post: camillelola
  Selecting file saved in a location excellentpawan 1 4,424 02-25-2014, 02:05 PM
Last Post: guin.anirban
  Copy file to network shared location sams001 0 3,435 04-03-2013, 02:10 AM
Last Post: sams001
MyBB Saving an excel file with the same name and same location after updating few columns pKrishna 1 5,365 01-04-2013, 04:40 PM
Last Post: Ankesh
  Moving QTP scripts from QC to a desktop PC adityasrinivasb 1 3,528 08-02-2011, 06:07 PM
Last Post: uma87

Forum Jump:


Users browsing this thread: 1 Guest(s)