473,414 Members | 1,954 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 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 3297
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Busyman | last post by:
Hi, I have written a stay-open-AppleScript for Mac OS X, gathering certain informations from different apps, which can only be gathered via AppleScript. This script writes its informations into...
29
by: Paul L. Du Bois | last post by:
Has anyone written a Queue.Queue replacement that avoids busy-waiting? It doesn't matter if it uses os-specific APIs (eg WaitForMultipleObjects). I did some googling around and haven't found...
1
by: marc.gibian | last post by:
I am writing a simple C# application to read some files in an FTP drop directory. Occasionally the program will attempt to open a file that is in the process of being written. FileStream will throw...
18
by: jmd | last post by:
Hello, I posted the following in the C# forum but without one answer. But perhaps now in vb.net someone has some guidelines ! This is my question : I want to write a vb.net program that does...
5
by: rjl444 | last post by:
My app has a lot of properties, instead of placing the values in webconfig file (because I have tons), I would like to place these in it's own file. What is the best way of using an independant...
5
by: gravey | last post by:
Hello. Apologies if this is a basic question, but I want to open a HTML file from my local drive (is generated by another Python script) in Internet Explorer. I've had a look at the webbrowser...
13
by: mike3 | last post by:
Hi. Busy-waiting is a known anti-pattern that should be avoided. However, in C, there is no standard alternative, so when a wait is required and it's not busy, the program becomes 100%...
4
by: Ty | last post by:
Hello all, I am creating a web site with Visual Stuido 2008. I am trying to use a java script file to create a busybox for login from this page http://blogs.crsw.com/mark/articles/642.aspx. I...
4
by: Mr Gray | last post by:
Hi Guys, My requirement is to scan an FTP directory for the presence of 4 files and if a specific file exists I can begin to GET those files, read the contents and save the contents into an SQL...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.