Author Topic: FileCopy, no information if sucessful or not?  (Read 1927 times)

Offline amichael

  • Associate
  • **
  • Join Date: Oct 2008
  • Posts: 1
  • Forum Citizenship: +0/-0
FileCopy, no information if sucessful or not?
« on: 21 Oct 2008 06:33:00 am »
Hi,

I'm working with decisionStream for some years, sometimes (and only sometimes) it drives me crazy:

within a Job I need to copy some files.
Until now, I did this with a System-Call:
System( 'copy c:\tmp\start.txt c:\Newfile.txt /y /V' )

unfortunately, there's no chance to see whether the copy was correct finished or aborted due to network trouble for example.

How can I get something like an error-code for the result of the Filecopy?

the same problem occurs for moving files or deleting them, which is also done with the help of system calls.


Regards, Andy

Offline jhleonp

  • Associate
  • **
  • Join Date: Oct 2008
  • Posts: 1
  • Forum Citizenship: +1/-0
Re: FileCopy, no information if sucessful or not?
« Reply #1 on: 31 Oct 2008 07:15:43 pm »
Hi...
  I´m using w2003 Server and i hade the same problem with xp pro and copy statement.

  In w2003 Server í´m using this, hope is usefull 4 u.

----------------------------------
Declare "res" as integer


$res := System('copy d:\hr.dat d:\temp /Y /v');
Return $res = 0 ;
------------------------------------

XCOPY:
0 success
1 no files found to copy
2 aborted by ^C
4 initialization error (not enough memory or disk space, invalid drive, or syntax error)
5 disk write error

Offline JoeBoxer

  • Full Member
  • ***
  • Join Date: Dec 2008
  • Posts: 19
  • Forum Citizenship: +0/-0
Re: FileCopy, no information if sucessful or not?
« Reply #2 on: 11 Jan 2009 07:36:08 am »
I can vouch for amichael's solution.  its simply a matter of retrieving the status codes from the copy command.

 



       
Twittear