I have an application that must check a folder and read any files that are copied into it. How do I test if a file in that folder is currently being written to? I only want
Catching exception is expensive you should try to use this:
http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx
There's a super clear example on the msdn page. That'll give you nice events on change, created, delete, renamed.
copy the file into the folder and rename when your done catch the rename event and your sure your not reading files that aren't finished yet.
Or you could catch the change events until (this is tricky) they aren't fired anymore.