473,383 Members | 1,725 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

FileSystemWatcher case bug

I'm running into a problem where the FSW events report all filenames in
lower case. (The directory portion is okay, just the leaf file name is
broken.)
I found this thread from 6/02 stating as such, and a reply presenting a
workaround.
However, creating a DirectoryInfo or FileInfo object with the path and
asking for the Name or FullName still reports the lower case version, not
the correct user case.

Any ideas short of opening the file's or folder's parent dir, enumerating
all the files, comparing w/o case, and returning the matching entry? (Not
that's it's hard, just hoping for a better way...)

thanks,
mike

..Net 1.1.4372
---------------------
Here is the fix for that bug

Pass the FullPath into the Constructor of a DirectoryInfo Class and Read the
Name Property.
--
Joe Feser
"Michael" <Mi*****@nowhere.com> wrote in message
news:eySuyptHCHA.2012@tkmsftngp13...
Is there an official place to submit this bug?

I'm not sure which of the two classes would be the source of the problem.
"System.IO.FileSystemEventArgs" or "System.IO.FileSystemWatcher"

to recreate:
1) Initialize a "System.IO.DirectoryInfo" instance to a folder name that has capital letters.
IE.
System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo("C:\New
Folder");
2) create the directory...
dir.Create();
3) create a "FileSystemWatcher" object to monitor the location where you
create the new folder.
4) in the Created event handler for the "FileSystemWatcher", examine the
"FileSystemEventArgs", property "FullPath" or "Name". You'll notice that
replaces all characters in the newly created portion of the "FullPath" with lower case letters.

Now when you display the name in a listview, it is forced to lower case. I
know this is going to annoy my users.


Jul 21 '05 #1
1 1787
I have had no end of problems with this. I have seen the case problem. If
I run from a service I get different results than a windows app.

I have a database that hold the name coming from Directory.GetFiles and that
is different than what is returned. For a new API dot.net is one screwed up
set of routines.
"Mike" <vi********@yahoo.com> wrote in message
news:ew**************@TK2MSFTNGP11.phx.gbl...
I'm running into a problem where the FSW events report all filenames in
lower case. (The directory portion is okay, just the leaf file name is
broken.)
I found this thread from 6/02 stating as such, and a reply presenting a
workaround.
However, creating a DirectoryInfo or FileInfo object with the path and
asking for the Name or FullName still reports the lower case version, not
the correct user case.

Any ideas short of opening the file's or folder's parent dir, enumerating
all the files, comparing w/o case, and returning the matching entry? (Not
that's it's hard, just hoping for a better way...)

thanks,
mike

.Net 1.1.4372
---------------------
Here is the fix for that bug

Pass the FullPath into the Constructor of a DirectoryInfo Class and Read the Name Property.
--
Joe Feser
"Michael" <Mi*****@nowhere.com> wrote in message
news:eySuyptHCHA.2012@tkmsftngp13...
Is there an official place to submit this bug?

I'm not sure which of the two classes would be the source of the problem. "System.IO.FileSystemEventArgs" or "System.IO.FileSystemWatcher"

to recreate:
1) Initialize a "System.IO.DirectoryInfo" instance to a folder name that

has
capital letters.
IE.
System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo("C:\New
Folder");
2) create the directory...
dir.Create();
3) create a "FileSystemWatcher" object to monitor the location where you
create the new folder.
4) in the Created event handler for the "FileSystemWatcher", examine the
"FileSystemEventArgs", property "FullPath" or "Name". You'll notice that replaces all characters in the newly created portion of the "FullPath"

with
lower case letters.

Now when you display the name in a listview, it is forced to lower case. I know this is going to annoy my users.


Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: David | last post by:
I have been working on trying to write a directory watcher service. One of the requirments is that it be able to watch multiple directories, not sub directories of one parent directory, but just...
3
by: Stampede | last post by:
Hi, I write an application which waits for incomming files in a specified directory. I thought, that using the FileSystemWatcher would be the best, as it does exactly what I need. But now I have...
2
by: Sacha Korell | last post by:
I need to set up a FileSystemWatcher in my web application (to automatically process uploaded files) and I'm trying to decide where to set it up. I would like to keep it within the web app, but it...
20
by: J-T | last post by:
We are working on an asp.net application which is a 3-tier application.I was aksed to create a component which monitors a folder and gets the file and pass them to a class library in our business...
1
by: Mike | last post by:
I'm running into a problem where the FSW events report all filenames in lower case. (The directory portion is okay, just the leaf file name is broken.) I found this thread from 6/02 stating as...
0
by: Silver Oak | last post by:
Hi, I'm experimenting with FileSystemWatcher but it doesn't seem like it fires when a new file is created. Everytime I create a new file, it fires Changed event i.e. Case...
12
by: ljh | last post by:
Has anyone else noticed that the FileSystemWatcher raises the changed event twice when a file is changed? Do you have any idea why this is the case?
5
by: Goran Djuranovic | last post by:
Hi all, I have a file system watcher service that works fine on a local hard drive, but will not work across the network. I tried both: mapping the drive and "\\..." path both no luck. I don't...
7
by: =?Utf-8?B?Tmljaw==?= | last post by:
Hello, I've got a FileSystemWatcher object setup to check for new files in a folder. I've never done much with threading, but I think I mght need to here. When I find a new file there are times...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.