Changing case of file names?

Mark Newton newton at atdot.dotat.org
Wed May 3 07:50:14 CST 2006


Andrew Speer wrote:

> You will probably get a million one-liner replies. Here is mine:
> find . -type f -exec perl -e '$_=shift; rename $_,lc($_) unless -f $_' {} \;

perl -e 'map { rename($_, lc($_)) unless (-f lc($_)) } <*[A-Z]*>'


Much more efficient:  Only invokes perl once (instead of once per file),
and only tries to rename files which actually have a capital letter in
their name.

(mind you, talking about efficiency when we're invoking perl to rename
some freakin' files offends my sensibilities just a bit :-)

   - mark

--------------------------------------------------------------------
I tried an internal modem,                    newton at atdot.dotat.org
      but it hurt when I walked.                          Mark Newton
----- Voice: +61-4-1620-2223 ------------- Fax: +61-8-82231777 -----


More information about the linuxsa mailing list