IO Exception: directory name is invalid using directory from File System Watcher OnChanged Event

Posted by Bi on Stack Overflow See other posts from Stack Overflow or by Bi
Published on 2010-04-27T02:35:31Z Indexed on 2010/04/27 2:53 UTC
Read the original article Hit count: 314

Filed under:
|

My C# application throws a System.IO.IOExcepton (The directory name is invalid) for the following code for implementing a filewatcher:

   public void OnChanged(object source, FileSystemEventArgs e)
   {
          DirectoryInfo dList = new DirectoryInfo(e.FullPath);
          FileInfo[] TxtFiles = dList.GetFiles("*.TXT");
   }

e.FullPath is "C:/Documents and Settings/Bi/Application Data/TestApp/Reports\\0MA01P62240_000005798_TRI_4947712701738551.TXT".

If you notice it seems to append a "\\" to the path when it tracks the file. Any idea what the problem may be?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET