Checking if a file has copied completly

J. Landman Gay jacque at hyperactivesw.com
Wed May 30 14:46:53 EDT 2007


Dave wrote:
> Hi,
> 
> The file size *may* work but as you say it's not very robust. One thing 
> I have noticed is that if you start to copy a big file (like a .mov) and 
> then before it's complete, double-click it so that QuickTime Player is 
> launched then you get a message saying the file is being used by Mac OS 
> X. If there was a way to perform the same check that would probably do 
> the trick.

I think the OS sets the file flag as "busy" during a write (at least on 
Macs, and I assume on Windows too.) So all you should need to do is try 
opening the file and then check the result. If it's busy, you'll get the 
appropriate error. Keep trying until the file opens.

You need to use the form "open file" rather than the URL syntax:

  open file <filepath>
  get the result
  if it is empty then
    -- whatever you need to do here
  end if

Put that in a repeat loop or a repeating pending message that exits if 
the result is empty, or times out after a specified amount of time.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list