Frank Galavan

Frank Galavan

  • NA
  • 9
  • 14.7k

Testing if a file is complete

Jul 16 2010 8:00 AM

I am kinda new to C#, so please bear with me.
What is the easiest way to test if a file is complete?
Let me explain. A company outside is sending us text files throughout the day. They can range is size from several thousand bytes to almost  250 megs. My program runs from a Scheduled Task throughout the day. The short files are usually no problem, but the big ones can be and often are still in the process of being transmitted into the directory from outside.
The way I have been testing this is to try and rename the file. If I get an exception, I know its still writing. Is there an easier way to test that a file is complete?
Thanks
Frank

Answers (2)