[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Filename case



> I'm using Debian .96 and have a need to change all the files in a
> directory from uppercase to lowercase (ftp'ed from DOS).  Is there a
> quick method or command to do this?

There is a command called 'rename' that comes with perl.  You can find
it as:

	/usr/doc/examples/perl/rename.gz

This is as found under debian 1.1.  Your milage may vary, so I'll
include the script here.

-----
#! /usr/bin/perl
# Usage: rename perlexpr [files]

($op = shift) || die "Usage: rename perlexpr [filenames]\n";
if (!@ARGV) {
    @ARGV = <STDIN>;
    chop(@ARGV);
}
for (@ARGV) {
    $was = $_;
    eval $op;
    die $@ if $@;
    rename($was,$_) unless $was eq $_;
}
-----

With this, you can do what you want by typing:

	rename tr/A-Z/a-z/ *


Perhaps the perl package could install this useful utility directly into
/usr/bin?
                                             
                                          Brian
                                 ( bcwhite@verisim.com )
                                             
-------------------------------------------------------------------------------
     measure with micrometer, mark with chalk, cut with axe, hope like hell



Reply to: