|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
File testHi,
Before I open a file to read it etc how can I test to ensure it not currently in use by another process? the scenario is that I'm watch for a file to be created once it is I read its contents and depending what they are I move it! however I'm getting error when I'm am reading the file before its is fully written ( the writing is slow as its over a WAN!) so I want to loop until the file is fully created/ written. thanks "Adrian" <Adrian@nospamhotmail.com.uk> schrieb No. If it was possible, it wouldn't make sense, because, between checking it> Hi, > Before I open a file to read it etc how can I test to ensure it > not currently in use by another process? and, if finding out it is not in use anymore, and opening it, the file could be opened again by another process. > the scenario is that I'm watch for a file to be created once it is I Armin> read its contents and depending what they are I move it! however I'm > getting error when I'm am reading the file before its is fully > written ( the writing is slow as its over a WAN!) so I want to loop > until the file is fully created/ written. If you have control over the application creating the file, have it
create it with a different filename while its writing and then, once complete, rename it. Otherwise you can trap the error and postpone your read/move. HTH Adrian wrote: Show quoteHide quote > Hi, > Before I open a file to read it etc how can I test to ensure it not > currently in use by another process? > > the scenario is that I'm watch for a file to be created once it is I read > its contents and depending what they are I move it! however I'm getting > error when I'm am reading the file before its is fully written ( the writing > is slow as its over a WAN!) so I want to loop until the file is fully > created/ written. > > thanks > > > Hi
thanks, this is what i have done i.e. do while, catch, open file... I thought I was missing a better approach! I also have an error counter and a sleep in the loop so as not to wait for ever and a day! Thanks Show quoteHide quote "Gman" <nah> wrote in message news:uOQE55kPGHA.1088@tk2msftngp13.phx.gbl... > If you have control over the application creating the file, have it create > it with a different filename while its writing and then, once complete, > rename it. > > Otherwise you can trap the error and postpone your read/move. > > HTH > > Adrian wrote: >> Hi, >> Before I open a file to read it etc how can I test to ensure it not >> currently in use by another process? >> >> the scenario is that I'm watch for a file to be created once it is I read >> its contents and depending what they are I move it! however I'm getting >> error when I'm am reading the file before its is fully written ( the >> writing is slow as its over a WAN!) so I want to loop until the file is >> fully created/ written. >> >> thanks >> >>
delete row from dataview
Source and design in two windows Convert double to string SELECT @@IDENTITY .NET 2.0 Conversion Wizard Flags Me.Cursor? fonts at runtime Property 'FlowBreak' accessible only at design mode ? Read a text file word by word Intermittent VS.Net Pauses during VB.NET code writing Detecting Terminal Server in VB.Net |
|||||||||||||||||||||||