I have a
VB.NET application that watches a directory for files to consume. Another, off the shelf, application drops files into this directory to be consumed by my application. Sometimes the provider app does not let go of the file before my app trys to use it and I get a "can't access myfile.txt because it is being used by another process" error. I am currently handling this with an api call to sleep(time in ms) but would prefer a more robust solution.
Is there a way to test a file to see if it is locked by another process? I have searched high and low and haven't found anything. I beleive there must be a way to test for such a common and simple thing but I have obviously missed it.
Thanks,
Rick