how normalize a filename & check for duplicates

hi

I need to know how to normalize 2 file pathnames, e.g:

C:\A\My Folder\BlaBla.jpg
C:\a\My Folder\Blabla.jpg

where a folder 'a' and 'A' and the filename is different in case. What I want to avoid is not overwriting the source and destination file if they are the same file. In 'C' I often used a flnorm() call.

thank you.

peter
[408 byte] By [pschiff] at [2007-11-19 2:00:48]
# 1 Re: how normalize a filename & check for duplicates
I dont know what you mean by "normalize" but if you have a :
dim a as string = "C:\A\My Folder\BlaBla.jpg"
dim b as string = "C:\a\My Folder\BlaBla.jpg"

you can do
a= a.tolower()
b=b.tolower()
so if you do an
if a=b then ...
will tell you that they are same.
And to check for a file existence you can do a File.Exists( a ) which is inside the System.IO;
I hope that helps.

Abubakar.
http://joehacker.blogspot.com
Abubakar at 2007-11-9 1:41:48 >
# 2 Re: how normalize a filename & check for duplicates
nope. your idea isnt good enough for if the filename is a short file name and the second is its long file name, i still need to know if its the same file. thanks anyway.
pschiff at 2007-11-9 1:42:57 >
# 3 Re: how normalize a filename & check for duplicates
What about FileInfo class? Create instances of the class, than you can test them for existence or compare it.

--Boudino
boudino at 2007-11-9 1:43:55 >