There are tons of ways to 'skin a cat' they say. 
Bash'yer and simpler, the better for me.

I rely on 'shell' or 'bourne' scripts the 'natural' language
for my ways.

Renaming of files posed in this thread, for example, I have:

$cat /appl/bin/mv.sh

    #!/bin/bash
    # rename files with uppercase names to lowercase
    for i in `cat fle.txt`
    do
    mv $i `echo $i | tr '[A-Z]' '[a-z]'`
    done

$ls -l /appl/bin/mv.sh

-rwx-r-x---      1    oscarp                71  Jul  31   11:19  mv.sh

$ls * > fle.txt

$cat fle.txt

jd.JPG
bj.JPEG

$/appl/bin/mv.sh

$ls  *

jd.jpg
bj.jpeg

$

> 
> Here's a handy perl script which lets you use perl statements to modify
> file names.  It may be the same thing as your rename program or not -
> rename is not a standard item in all distributions.
> 
> ----------------------------------------------------------
> #!/usr/local/bin/perl
> 
> # rename script examples from lwall:
> #       rename 's/\.orig$//' *.orig
> #       rename 'y/A-Z/a-z/ unless /^Make/' *
> #       rename '$_ .= ".bad"' *.f
> #       rename 'print "$_: "; s/foo/bar/ if <stdin> =~ /^y/i' *
> 
> $op = shift;
> for (@ARGV) {
>     $was = $_;
>     eval $op;
>     die $@ if $@;
>     rename($was,$_) unless $was eq $_;
> }
> ----------------------------------------------------------
> 
> To do it recursively, you'd combine it with find and xargs:
> 
>     find . -print0 | xargs -0 rename 's/\.JPE?G$/.jpg/i'
> 
> that will turn .JPG, .jpeg or .JPEG suffixes into .jpg


http://www.acay.com.au/~oscarp/disclaimer.html

-- 
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to