Case-sensitive file name returned from FileSystemWatcher?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,

I know, windows does not care about cases in file names, however, I need to
get the file name returned from the FileSystemWatcher case sensitive. Does
anyone know a workaround to this bug (at least that's what I think)? Thanks.

Dave
 
First thing that comes to mind, is to make a MD5 or SHA1 hash from what the
filename SHOULD look like, then compare the testing filenames' hash against
that...

Seems kind of clunky, but should work.
 
It is a bug. See http://tinyurl.com/6om8g for a little more info. I guess
what you can do is to once you get that event, you can re-get the list.

After the Changed() event occurs:

string[] fi = Directory.GetFiles(<the directory>,<the file that
changed in lower case>);
fi[0] will contain the Case correct file name.
 
Back
Top