On Sat, Sep 20, 2003 at 05:06:26PM -0400, Jeff Elkins wrote:
> I need to convert a bunch of filenames to uppercase. I tried the script below, 
> which does...nothing.
> 
> #!/bin/sh
> for file in $*
>  do
>  if [ -f $file ]
>  then
>   ucfile=`echo $file | tr [a-z] [A-Z]`
>   if [ $file != $ucfile ]
>   then
>   mv -i $file $ucfile
>   fi     
>  fi
>  done

#!/usr/bin/perl
@files=`ls`;
foreach $file (@files)
{
    chomp $file;
    if(-f $file)
    {
        $newname = uc $file;
        `mv $file $newname`;
    }
}

This should do what you want.

Bijan
-- 
Bijan Soleymani <[EMAIL PROTECTED]>
http://www.crasseux.com

Attachment: signature.asc
Description: Digital signature

Reply via email to