473,399 Members | 3,302 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,399 software developers and data experts.

FileWatcher and File case

Why does the System.IO.FileSystemEventArgs (in FileSystemWatcher object)
return lower case for the file? i.e. e.FullName will return
"c:\testingfilename.xml" instead of the origiiinal "c:\TestingFileName.xml".
Do I have the option to get the original case back? Thanks,

Nov 21 '05 #1
7 1176
What difference doe it make? Windows file names are not case sensitive, you
can't have two files with the same name in the same base path, distinction
is not attained by case.
c:\File1.xml
C:\file1.xml --> same file
"John" <Jo**@hotmail.com> wrote in message
news:uR****************@TK2MSFTNGP09.phx.gbl...
Why does the System.IO.FileSystemEventArgs (in FileSystemWatcher object)
return lower case for the file? i.e. e.FullName will return
"c:\testingfilename.xml" instead of the origiiinal
"c:\TestingFileName.xml". Do I have the option to get the original case
back? Thanks,

Nov 21 '05 #2
You don't answer my question. Is it possible or not? End users don't like to
see the file case changes when I copy the changed files to another
directories.

"Jared" <as***********@nospam.com> wrote in message
news:10*************@corp.supernews.com...
What difference doe it make? Windows file names are not case sensitive,
you can't have two files with the same name in the same base path,
distinction is not attained by case.
c:\File1.xml
C:\file1.xml --> same file
"John" <Jo**@hotmail.com> wrote in message
news:uR****************@TK2MSFTNGP09.phx.gbl...
Why does the System.IO.FileSystemEventArgs (in FileSystemWatcher object)
return lower case for the file? i.e. e.FullName will return
"c:\testingfilename.xml" instead of the origiiinal
"c:\TestingFileName.xml". Do I have the option to get the original case
back? Thanks,


Nov 21 '05 #3
John,
e.FullPath should return the name of the file, it shouldn't force case
change (non-substantiated assessment) . I tested this on my computer, and,
sure enough the original case remained. Are you sure you are not changing
the case somewhere in your method? You can always use a FileInfo object and
use it's FullName property to get the original file name (assuming you're
handling change, rename, created events).

' Assumes Imports System.IO

Dim fseaPath, fiPath As String
Dim f As New FileInfo(e.FullPath)
fseaPath = e.FullPath
fiPath = f.FullName
MessageBox.Show("FileSystemEventArgs Path: " & fseaPath & ControlChars.CrLf
& "FileInfo Path: " & fiPath)
' The results I received were exactly the same, original file name,
unchanged case

"John" <Jo**@hotmail.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
You don't answer my question. Is it possible or not? End users don't like
to see the file case changes when I copy the changed files to another
directories.

"Jared" <as***********@nospam.com> wrote in message
news:10*************@corp.supernews.com...
What difference doe it make? Windows file names are not case sensitive,
you can't have two files with the same name in the same base path,
distinction is not attained by case.
c:\File1.xml
C:\file1.xml --> same file
"John" <Jo**@hotmail.com> wrote in message
news:uR****************@TK2MSFTNGP09.phx.gbl...
Why does the System.IO.FileSystemEventArgs (in FileSystemWatcher object)
return lower case for the file? i.e. e.FullName will return
"c:\testingfilename.xml" instead of the origiiinal
"c:\TestingFileName.xml". Do I have the option to get the original case
back? Thanks,



Nov 21 '05 #4
Thanks for your help. I'll try again tonight and let you know. So far I only
get the lower case back (never change the file case anywhere in my
project!). I'l' try to use FileInfo object tonight. Thanks again.

John

"Jared" <as***********@nospam.com> wrote in message
news:10*************@corp.supernews.com...
John,
e.FullPath should return the name of the file, it shouldn't force case
change (non-substantiated assessment) . I tested this on my computer, and,
sure enough the original case remained. Are you sure you are not changing
the case somewhere in your method? You can always use a FileInfo object
and use it's FullName property to get the original file name (assuming
you're handling change, rename, created events).

' Assumes Imports System.IO

Dim fseaPath, fiPath As String
Dim f As New FileInfo(e.FullPath)
fseaPath = e.FullPath
fiPath = f.FullName
MessageBox.Show("FileSystemEventArgs Path: " & fseaPath &
ControlChars.CrLf & "FileInfo Path: " & fiPath)
' The results I received were exactly the same, original file name,
unchanged case

"John" <Jo**@hotmail.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
You don't answer my question. Is it possible or not? End users don't like
to see the file case changes when I copy the changed files to another
directories.

"Jared" <as***********@nospam.com> wrote in message
news:10*************@corp.supernews.com...
What difference doe it make? Windows file names are not case sensitive,
you can't have two files with the same name in the same base path,
distinction is not attained by case.
c:\File1.xml
C:\file1.xml --> same file
"John" <Jo**@hotmail.com> wrote in message
news:uR****************@TK2MSFTNGP09.phx.gbl...
Why does the System.IO.FileSystemEventArgs (in FileSystemWatcher
object) return lower case for the file? i.e. e.FullName will return
"c:\testingfilename.xml" instead of the origiiinal
"c:\TestingFileName.xml". Do I have the option to get the original case
back? Thanks,




Nov 21 '05 #5
> You don't answer my question. Is it possible or not?

Right out of my own program...

'Save the real filename for later use
m_sFilename = New IO.FileInfo(filename).FullName
What difference doe it make?
I need to display files using their proper filenames. It is too hard to read
file names that are all lowercase such as "incsubmitvolunteer.asp".
Windows file names are not case sensitive,
you can't have two files with the same name in the same base path,
distinction is not attained by case.

Actually it is, otherwise it wouldn't save the case, just like FAT16. IIRC,
you can have two files that differ only in case when using POSIX support,
but its dangerous.

--
Jonathan Allen
"John" <Jo**@hotmail.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl... You don't answer my question. Is it possible or not? End users don't like to see the file case changes when I copy the changed files to another
directories.

"Jared" <as***********@nospam.com> wrote in message
news:10*************@corp.supernews.com...
What difference doe it make? Windows file names are not case sensitive,
you can't have two files with the same name in the same base path,
distinction is not attained by case.
c:\File1.xml
C:\file1.xml --> same file
"John" <Jo**@hotmail.com> wrote in message
news:uR****************@TK2MSFTNGP09.phx.gbl...
Why does the System.IO.FileSystemEventArgs (in FileSystemWatcher object) return lower case for the file? i.e. e.FullName will return
"c:\testingfilename.xml" instead of the origiiinal
"c:\TestingFileName.xml". Do I have the option to get the original case
back? Thanks,



Nov 21 '05 #6
I have a workaround soultion, but it's not very efficient.

protected void fileSystemWatcher_Renamed(object sender,
System.IO.RenamedEventArgs e)
{
string[] allFiles =
Directory.GetFiles(Path.GetDirectoryName(e.FullPat h));
string newFullPath = e.FullPath;

foreach(string file in allFiles)
{
if(string.Compare(file, e.FullPath, true) == 0)
{
newFullPath = file;
break;
}
}

// newFullPath will have the correct name now
Debug.WriteLine("Renamed file: " + newFullPath);

}

Nov 21 '05 #7
I have a workaround soultion, but it's not very efficient.

protected void fileSystemWatcher_Renamed(object sender,
System.IO.RenamedEventArgs e)
{
string[] allFiles =
Directory.GetFiles(Path.GetDirectoryName(e.FullPat h));
string newFullPath = e.FullPath;

foreach(string file in allFiles)
{
if(string.Compare(file, e.FullPath, true) == 0)
{
newFullPath = file;
break;
}
}

// newFullPath will have the correct name now
Debug.WriteLine("Renamed file: " + newFullPath);

}

Nov 21 '05 #8

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

Similar topics

4
by: Ron King Jr | last post by:
I have a small problem with my windows service. The first time I start the service everything works the way it's suppose to, but randomly the service fails. The jist of the service is to use the...
7
by: John | last post by:
Why does the System.IO.FileSystemEventArgs (in FileSystemWatcher object) return lower case for the file? i.e. e.FullName will return "c:\testingfilename.xml" instead of the origiiinal...
6
by: Troy Murphy | last post by:
The help file for Visual Studio .NET version 1 had a Walkthru for installing a Windows Service that would monitor a folder. Version 1.1 does not seem to have that example anymore. Could someone...
0
by: Jason | last post by:
I created a FileWatcher service to watch a folder. When a new file is created in the folder, I want to start a process. Everything works fine if I cut-and-paste a test file from my hard-drive; as...
2
by: Roger Twomey | last post by:
I am working on a filewatcher application. The premis is: User uploads an xml file onto the web server the filewatcher app sees the xml file filewatcher app reads the file and inserts...
1
by: ba.hons | last post by:
Hello, I have a file watcher object which i use to check a directory for XML files. When an XML file is placed in the directory i check the filename, to make sure it for me, then parse the...
3
by: ba.hons | last post by:
Hello All. I have a filewatcher object which looks at a shared folder and when a new XML file is placed in this folder the on create method calls a method which reads the XML file and based on...
0
by: tshad | last post by:
I have a filewatcher program that is working syncronously (which is how I want it to work). But my program will handle whatever files are in the folder at the time it runs. So when I drop 15...
7
by: tshad | last post by:
What exactly is FileWatcher doing? When you drop 100 files in a folder it is watching, it normally will fire of the event 100 times. In my case, I do all my processing on the first event so I...
3
by: Aussie Rules | last post by:
Hi I create a number of filewatchers in my code. I have a need to delete some of the file watchers, but can not figure out how to do this without stopping the application and restarting. To...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.