detecting a file has finished copying (using xcopy)

Hi I have a unique problem here. My program writes a batch file, which in turn uses xcopy to copy particular files to remote machines. In addition, the remote machines will run the files which are copied.

Now my question is how am I able to find out (on the cilent side) my file has finished coping using the xcopy. Use file exists or find the length (size) of the file?

Heres a snippet of the pseudo code:

Server

if (send button is press)

open batch filefor writing commands

xcopy ..\test.exe

xcopy ..\test2.exe

endif

Cilent:

if(xcopy is finished)

execute test.exe

execute test2.exe

endif

Many thanks

Message was edited by:

Zsefv

[910 byte] By [Zsefva] at [2007-11-27 8:51:01]
# 1
The easy way is to send a message from the Server to Client when the xcopy finish.So the client block until receive the message.cya.
pbulgarellia at 2007-7-12 21:03:28 > top of Java-index,Java Essentials,Java Programming...
# 2
why are you using xcopy? does java not provide functionality which xcopy provides?
mkoryaka at 2007-7-12 21:03:28 > top of Java-index,Java Essentials,Java Programming...
# 3
> why are you using xcopy? does java not provide> functionality which xcopy provides?Would file.deleteOnExit() be handy? I've always wanted to use that method :-)
BigDaddyLoveHandlesa at 2007-7-12 21:03:28 > top of Java-index,Java Essentials,Java Programming...
# 4
Check this out: http://forum.java.sun.com/thread.jspa?threadID=651443&messageID=3833252Message was edited by: Danniel_Willian
Danniel_Williana at 2007-7-12 21:03:28 > top of Java-index,Java Essentials,Java Programming...
# 5

@pbulgarelli

my question is how do i know when the copying is finished...

@mkoryak

Java's socket copying not very reliable. I do not know why sometimes a byte is lost and do not wish to spend time debugging it.

@BigDaddyLoveHandles

I dont think i want to delete the file after copying...

@Danniel_Willian

I do not think that thread helps much... I have googled for it and this is another thread which may be of use i hope

http://forum.java.sun.com/thread.jspa?threadID=423493&messageID=1886835

Zsefva at 2007-7-12 21:03:28 > top of Java-index,Java Essentials,Java Programming...
# 6

> @pbulgarelli

> my question is how do i know when the copying is

> finished...

Process proc = Runtime.getRuntime().exec("xcopy ......");

proc.waitFor(); // WAIT UNTIL XCOPY FINISH

//AT THIS POINT THE XCOPY FINISHED AND YOU CAN SEND A MESSAGE TO YOUR CLIENT...

> @mkoryak

> Java's socket copying not very reliable. I do not

> know why sometimes a byte is lost and do not wish to

> spend time debugging it.

Are u insane ? hehehehe

the Sockets works well, and its easy to use.

Did I help this time?

cya

pbulgarellia at 2007-7-12 21:03:28 > top of Java-index,Java Essentials,Java Programming...
# 7
> Java's socket copying not very reliable.Rubbish.> I do not know why sometimes a byte is lostI do. Bugs in your code.
ejpa at 2007-7-12 21:03:28 > top of Java-index,Java Essentials,Java Programming...
# 8
> > Java's socket copying not very reliable.> > Rubbish.> Except insofar as any network can never be relied on to not go down at the most inopportune moment, but that's got nothing to do with Java.
jwentinga at 2007-7-12 21:03:28 > top of Java-index,Java Essentials,Java Programming...
# 9
and you don't just lose a byte here and there ...
ejpa at 2007-7-12 21:03:28 > top of Java-index,Java Essentials,Java Programming...