471,071 Members | 1,328 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,071 software developers and data experts.

File is busy

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
Feb 6 '06 #1
3 3147
I have used:

Do
Try
file.copy(source,dest)
Exit Do
Catch
End Try
Loop

"vul" <aa*@optonline.net> wrote in message
news:us**************@TK2MSFTNGP10.phx.gbl...
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

Feb 6 '06 #2
vul
Terry, thanks a lot. I works.
Al

"Terry Olsen" <to******@hotmail.com> wrote in message
news:uQ**************@TK2MSFTNGP10.phx.gbl...
I have used:

Do
Try
file.copy(source,dest)
Exit Do
Catch
End Try
Loop

"vul" <aa*@optonline.net> wrote in message
news:us**************@TK2MSFTNGP10.phx.gbl...
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


Feb 6 '06 #3
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.
--
Dennis in Houston
"vul" wrote:
Terry, thanks a lot. I works.
Al

"Terry Olsen" <to******@hotmail.com> wrote in message
news:uQ**************@TK2MSFTNGP10.phx.gbl...
I have used:

Do
Try
file.copy(source,dest)
Exit Do
Catch
End Try
Loop

"vul" <aa*@optonline.net> wrote in message
news:us**************@TK2MSFTNGP10.phx.gbl...
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



Feb 7 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Busyman | last post: by
29 posts views Thread by Paul L. Du Bois | last post: by
1 post views Thread by marc.gibian | last post: by
5 posts views Thread by rjl444 | last post: by
5 posts views Thread by gravey | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.