Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

[Windows] Given lower-cased file name, how to get actual file name (stored on filesystem) ?

by anykeyman (Novice)
on Oct 22, 2012 at 12:07 UTC ( #1000315=perlquestion: print w/ replies, xml ) Need Help??
anykeyman has asked for the wisdom of the Perl Monks concerning the following question:

(I know that I can use readdir for that. But I seek more elegant way.)

UPD: to make it more clear, I need to get full correct-cased path.

Like that: '../../foo/bar/baz' -> '../../Foo/BaR/bAZ'

(I can write a module for that using readdir, but I think there is a way to do so that without directory traversing.)

Comment on [Windows] Given lower-cased file name, how to get actual file name (stored on filesystem) ?
Re: [Windows] Given lower-cased file name, how to get actual file name (stored on filesystem) ?
by Anonymous Monk on Oct 22, 2012 at 12:52 UTC

      How does the linked module address the problem? I fail to see documentation for "case-correction" in its documentation, unless you intend it to be a fancy wrapper around readdir.

        Eh?
        $ md tmpblah $ echo > tmpblah\aone.pl $ echo > tmpblah\bOne.pl $ echo > tmpblah\cONe.pl $ echo > tmpblah\dONE.pl $ perl -MPath::Class::Rule -le "print for Path::Class::Rule->new->file +->iname(qr/.one.pl/)->all(q/tmpblah/) " tmpblah\aone.pl tmpblah\bOne.pl tmpblah\cONe.pl tmpblah\dONE.pl
Re: [Windows] Given lower-cased file name, how to get actual file name (stored on filesystem) ?
by Corion (Pope) on Oct 22, 2012 at 12:54 UTC
      Thanks! That's exactly what I needed;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1000315]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (9)
As of 2015-07-05 20:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (68 votes), past polls