Jump to content
Sign in to follow this  
Stalker0

Determining the End of a File Copy

Recommended Posts

Stalker0

I'm running a script that involves copying a file, and the script needs to wait until the file is finished copying before it continues. I'm looking for ways to determine when the file stops copying.

My current idea is to run a loop which checks the file size every 5 seconds or so, if the size is unchanged, the program assumes the file is done. Does anyone know a better way to do this?

Share this post


Link to post
Share on other sites
lordofthestrings

I would suggest:

runwait() (with @comspec and @SW_HIDE macros)

run a dos copy (or xcopy if you like) command from this runwait()

then use adlibenable() to loop at the interval you specify (5 seconds)

in this adlibenable function check with

processexists()

wether process CMD.EXE exists..


Share this post


Link to post
Share on other sites
2TMax

Why not use the exaple "Demonstrates StdoutRead()".

It'll create a command console, executes a command, waits till it's ended. meanwhile it captures text sended to console.

no needless looping, keeps track of processing and gives you the oppurtunity to act on failures/successes.

Abit less complex is: check for the return value. '0' = Oke '1' to '4' = trouble


Sorry for my poor English, I'm just a bloody forainer from the flat country called Nederland.

Share this post


Link to post
Share on other sites
Stalker0

Why not use the exaple "Demonstrates StdoutRead()".

It'll create a command console, executes a command, waits till it's ended. meanwhile it captures text sended to console.

no needless looping, keeps track of processing and gives you the oppurtunity to act on failures/successes.

Abit less complex is: check for the return value. '0' = Oke '1' to '4' = trouble

Where is this example located, I didn't see it in the standard autoit examples.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×