[Tutor] Checking a file size before moving it

alan.gauld@bt.com alan.gauld@bt.com
Fri Jan 31 06:02:02 2003


> On the Unix platform, I use the following scheme to
> ascertain that a file is no longer being written:
> 
> stat the file and get its size(size1)
> sleep for 10 seconds
> stat the file again and get its size(size2)
> if size2 == size1 proceed with the move operation

I'm pretty sure theres a better way that doesn't 
involve sleep at all, but I can't think what it is right now!

> This works fine in Unix but I am not sure sleep works
> OK in Win32 since I had some problems in the past
> doing something similar with VB6. 

sleep() works OK, it doesn't use the Win32 timer event
mechanism that VB uses.

> Can anybody suggest a different way of checking if the
> copy operation has been completed? 

I'm thinking about it :-)

Alan g