locked
How to check for "Success" or "Failure" after File.Copyfile RRS feed

  • Question

  • File.CopyFile is suppose to return "Success" or "Failure" after it executes.

    Can someone tell me please how to test for either?

    moorem34
    Thursday, March 5, 2009 12:37 AM

Answers

  • The "Success" or "Failed is returned from the command.  Use a variable to hold it. 

    Status=FileCopyFile("FromSomeFile","ToSomeFile")

    if Status="Success" then
    writeline("File copied successfully")
    else
    writeline("File copy failed")
    endfor

    JR
    • Marked as answer by moorem34 Friday, March 6, 2009 12:51 PM
    Thursday, March 5, 2009 1:32 AM
    Answerer

All replies

  • The "Success" or "Failed is returned from the command.  Use a variable to hold it. 

    Status=FileCopyFile("FromSomeFile","ToSomeFile")

    if Status="Success" then
    writeline("File copied successfully")
    else
    writeline("File copy failed")
    endfor

    JR
    • Marked as answer by moorem34 Friday, March 6, 2009 12:51 PM
    Thursday, March 5, 2009 1:32 AM
    Answerer
  • Thanks JR

    moorem34
    • Proposed as answer by Davith Saturday, April 18, 2009 10:17 AM
    Friday, March 6, 2009 12:32 PM
  • Thanks to moorem34 for question and to JR for the answer here follows a file created that worked successfully!

    Status = File.CopyFile( "C:\me.txt", "C:\Test\")
    textwindow.writeline(" Status is " + Status )      'Display of Status returned

    if Status = "SUCCESS" then
    textwindow.writeline("File copied successfully")
    else
    textwindow.writeline("File copy failed")
    endif

    Thanks again chaps

    Saturday, April 18, 2009 10:23 AM