File finshed being copied

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to copy a file from a Source location to a Destination location, but
the file is sometimes in the process of being copied to that Source location.

How can I check that the file has been copied to the Source location and is
ready to be copied to the Destination location, without me getting a "being
used by another process" exception.

Thanks, Craig
 
AFAIK there is no good way how you can detect if file is fully copied or
still being copied.

For e.g. application can open file for exclusive use, then all others will
not receive access to the file.

If the code that copies source file is your own, you can create mutex ( for
interprocess ) or event ( for inprocess)
synchronization. That is if copying is finished event is signaled, and you
can start copying file to other location.
 
I always put my file copies in a Try...Catch... handler for this very
reason. Sometimes I ignore the error and other times I wait for a few
seconds and try again.

Mike Ober.
 
Back
Top