On Thursday 04 November 2004 10:39, Rajarshi Guha wrote:
> On Wed, 2004-11-03 at 21:28, dipankar das wrote:
>
> > When renaming MSW upper-case filenames to lowercase,
> > there is 'lc' from shtools, and other ways too. Or, for
> > massive multiway multioption renaming there are heavy-duty
> > packages like 'krename'.
> >

>
> tr, find and bash is all you need :)
>

The script i posted was by mistake a wrong one. This one works.
--------------------------------------------------------------------
#!/bin/bash

# glt, 2004

echo Changing Filename
echo From upper-case to lower and eliminating whitespace
echo "1 replaces whitespace with dot (.)"
echo "2 annihilates whitespace"
echo What is your option?
read option

for oldfile in *
do
newfile="$oldfile"
test $option -eq 1 && newfile=`echo $oldfile| tr [:upper:] [:lower:]| tr 
[:blank:] '.'`
test $option -eq 2 && newfile=`echo $oldfile| tr [:upper:] [:lower:]| tr -d 
[:blank:]`
test $option -eq 1 || test $option -eq 2 || echo Are you literate? 

if [ "$newfile" != "$oldfile" ]
then
mv "$oldfile" "$newfile"
fi

done
-----------------------------------------------------------------------------


--
To unsubscribe, send mail to [EMAIL PROTECTED] with the body
"unsubscribe ilug-cal" and an empty subject line.
FAQ: http://www.ilug-cal.org/node.php?id=3

Reply via email to