[KLUG Members] case

Jamie McCarthy members@kalamazoolinux.org
Fri, 5 Apr 2002 21:09:50 -0500


Here's a perl one-liner to do it recursively, in case your website
has files in more than one directory.  It operates on all files in
the current directory, and goes down through all subdirectories.

   perl -MFile::Find -le 'find { wanted => sub { rename $_, "\L$_"
   or die "err: $!" if /[A-Z]/ }, bydepth => 1 }, "."'

E.g.,

   ~/test$ ls -R
   .:
   AbC  IJK  LmN  dEf  fgh  nop

   ./LmN:
   St  qR  uv

   ./nop:
   1  X  X83r5tIg2ld8RjE  YZ  w

   ./nop/X83r5tIg2ld8RjE:
   Q


   ~/dl/test$ perl -MFile::Find -le 'find { wanted => sub { rename $_, "\L$_"
   > or die "err: $!" if /[A-Z]/ }, bydepth => 1 }, "."'


   ~/test$ ls -R
   .:
   abc  def  fgh  ijk  lmn  nop

   ./lmn:
   qr  st  uv

   ./nop:
   1  w  x  x83r5tig2ld8rje  yz

   ./nop/x83r5tig2ld8rje:
   q

Or, I think you could pipe the output of "find . -type f" to Bruce's
"lowerfile" script and that would do it recursively too.

Either way, make backups just in case :)
--
 Jamie McCarthy
 jamie@mccarthy.vg