Case sensitive filename in WinNT 
Author Message
 Case sensitive filename in WinNT

I'm using a perl written tool on both Win NT and Solaris. It works a lot
with files. The problem is, Win NT will not report any problems if the
case is not matched. E.g.
open (MYFILE,">TestFile.txt")
will yield the same result as
open (MYFILE,">testfile.txt")
would.
When running the program on Solaris, only one of the filenames from the
above example will work.
Now the question:
Is it possible to get hands on the "real" filename under NT to check if
the name is spelled correctly and have thus the same behaviour as under
Solaris ? My only idea was via filename globbing, but that seems quite
awkward...

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Sun, 09 Feb 2003 03:00:00 GMT  
 Case sensitive filename in WinNT

Quote:

>I'm using a perl written tool on both Win NT and Solaris. It works a lot
>with files. The problem is, Win NT will not report any problems if the
>case is not matched. E.g.
>open (MYFILE,">TestFile.txt")
>will yield the same result as
>open (MYFILE,">testfile.txt")
>would.
>When running the program on Solaris, only one of the filenames from the
>above example will work.
>Now the question:
>Is it possible to get hands on the "real" filename under NT to check if
>the name is spelled correctly and have thus the same behaviour as under
>Solaris ? My only idea was via filename globbing, but that seems quite
>awkward...

Or do a readdir and do pattern matching (m/^($filename)$/i).  Note that
you will have other differences with Unix.  

In Unix, if the file you want isn't there, you can just create it.  In
NT, you can't have two case spellings.  You'd have to rename the first
one.  That might confuse someone that's being told that the file isn't
there.

--

Unix System Administrator                    Taos - The SysAdmin Company
Got some Dr Pepper?                               San Francisco Bay Area
      < Please move on, ...nothing to see here,  please disperse >



Mon, 10 Feb 2003 03:00:00 GMT  
 Case sensitive filename in WinNT

Quote:

>I'm using a perl written tool on both Win NT and Solaris. It works a lot
>with files. The problem is, Win NT will not report any problems if the
>case is not matched. E.g.
>open (MYFILE,">TestFile.txt")
>will yield the same result as
>open (MYFILE,">testfile.txt")
>would.
[snip]
>Is it possible to get hands on the "real" filename under NT to check if
>the name is spelled correctly and have thus the same behaviour as under
>Solaris ?

The file names returned by readdir() should be what you want.

--

Washington, DC



Mon, 10 Feb 2003 03:00:00 GMT  
 Case sensitive filename in WinNT
) I'm using a perl written tool on both Win NT and Solaris. It works a lot
) with files. The problem is, Win NT will not report any problems if the
) case is not matched. E.g.
) open (MYFILE,">TestFile.txt")
) will yield the same result as
) open (MYFILE,">testfile.txt")
) would.
) When running the program on Solaris, only one of the filenames from the
) above example will work.
) Now the question:
) Is it possible to get hands on the "real" filename under NT to check if
) the name is spelled correctly and have thus the same behaviour as under
) Solaris ? My only idea was via filename globbing, but that seems quite
) awkward...

use Win32;
my $name= "sOuRce";
my $realName= GetLongPathName($name);
print "($name) works for ($realName)\n";
__END__
produces:
(sOuRce) works for (Source)
for me.

Of course, this won't work if someone accesses the file by the
"short" name like "PROGRA~1".  I guess you could do:

use Win32;
my $name= "sOuRce";
if(  $name eq GetLongPathName($name)
 ||  $name eq GetShortPathName($name)  ) {
    # ...

Quote:
}

But that won't handle "mixed" paths.
--
Tye McQueen    Nothing is obvious unless you are overlooking something
         http://www.metronet.com/~tye/ (scripts, links, nothing fancy)


Fri, 14 Feb 2003 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Ans:Dupe recs/Key violations

2. Welcome to Pascal Central

3. Stack OverFlow

4. Compile .pas to .exe

5. Btrive driver

6. Help! Delphi 3 & DAO 3.0

7. dynamic case (in)sensitive matching

8. index() case sensitive !?!?!

9. Case ($in)sensitive match

10. Case Sensitive Problem doing Pattern Matching

11. case sensitive

12. Is PERL case sensitive?

 

 
Powered by phpBB® Forum Software