This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to convert a path to the correct case


On Wed, 14 Sep 2005, dalewking wrote:

> Cygwin itself is case preserving, but case insensitive. Other tools are
> not so flexible on case. In my case I have some issues with incorrect
> case and my makefile.
>
> Consider if I had a directory /foo/BAR. Cygwin will let you actually do
> "cd /Foo/bar" and work happily. Pwd will actually return "/Foo/bar"
> instead of the real path in this case.
>
> It would be really helpful to have a way given a string like "/Foo/bar"
> to convert that to the real correct case "/foo/BAR".
>
> But I'm having trouble finding an easy, convenient way to do that. As I
> said pwd doesn't do it nor does cygpath.
>
> One way that works is to turn the path into a pattern. You can do "ls
> /Foo/bar*" but that will return multiple strings if there is more than
> one file that starts with BAR. You can do "ls /Foo/ba[r]" but then how
> do I easily add the brackets into the string? I've tried various things
> with find, but none do the conversion.
>
> Anyone have a good idea how to do this conversion.

<http://cygwin.com/cygwin-ug-net/using-cygwinenv.html>, and search for
check_case.  You want "check_case:adjust".  Don't let the warning scare
you off... :-D

Alternatively, if you *are* scared off by the warning, you could do

ls -1 /Foo/bar* | head

HTH,
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

If there's any real truth it's that the entire multidimensional infinity
of the Universe is almost certainly being run by a bunch of maniacs. /DA

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]