File is busy

  • Thread starter Thread starter vul
  • Start date Start date
V

vul

I need to copy the file (OutboxLog.txt produced by Fax service) right after
it was updated. I'm using:
System.IO.File.Copy(strSource, strDestination, True) to do that, but if the
source file is busy (was not closed yet after update) the copy process
fails.
I tried to insert a loop:
For lngAttempt = 0 To 100000

Application.DoEvents()

Next


It works, but I don't like this approach. I would prefer something like:
Do While IsBusy = True
IsBusy = (some code which returns the status of the file)
Loop

Unfortunately I do not know what do I have to put on the right in this
expression.
Any idea please

Thank you

Al
 
As many times as this question is ask on the newsgroups, you'd think M'soft
would get the message and implement a property or method for FileInfo to get
the file status like busy, opened for readonly, opened for write, etc. by
another applicaiton.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top