473,387 Members | 3,033 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,387 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,

Jul 21 '05 #1
7 1537
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,

Jul 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,


Jul 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,



Jul 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,




Jul 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,



Jul 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);

}

Jul 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);

}

Jul 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...
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...
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...
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...
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
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.