Neat utility to convert uppercase filenames

Randal L. Schwartz merlyn at iwarp.intel.com
Tue Dec 11 15:25:30 AEST 1990


In article <PINARD.90Dec10184326 at kovic.IRO.UMontreal.CA>, pinard at IRO (Francois Pinard) writes:
| I use this:
| 
| #!/bin/sh
| # Convert upper case in file names to lower case.
| # Copyright (C) 1990 Free Software Foundation, Inc.
| # Francois Pinard <pinard at iro.umontreal.ca>, October 1990.
| 
| echo $* \
| 	| tr " " "\012" \
| 	| gawk '{ if ($1 != tolower($1)) { print "mv", $1, tolower($1) } }' \
| 	| sh
| 
| I'm sure there is a one-liner in Perl to do the same :-).

Like:

perl 'for (@ARGV) {($n = $_) =~ y/A-Z/a-z/; rename($_,$n) unless -e $n;}' *

Just another Perl hacker,
-- 
/=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\
| on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III      |
| merlyn at iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn |
\=Cute Quote: "Intel: putting the 'backward' in 'backward compatible'..."====/



More information about the Alt.sources.d mailing list