On Tue, 15 Jul 2003 21:53:15 -0500
Chris <[EMAIL PROTECTED]> wrote:

> On Tuesday 15 July 2003 09:25 pm, Todd Slater wrote:
> > On Tue, 15 Jul 2003 20:35:15 -0500
> >
> > Chris <[EMAIL PROTECTED]> wrote:
> > > At one time a long ways back someone posted, I think it was a
> > > small script file to change the case of file extensions, ie..MP3
> > > to .mp3. Does anyone have that laying around?  I've been googling
> > > and found a few, but none seem to work correctly.
> > >
> > > Thanks
> > > Chris
> >
> > Or, to change *all* extensions to lowercase:
> > (assuming you are in the directory you want to do this)
> >
> > #/bin/bash
> > for i in *
> > do
> >         name=`echo $i|cut -d '.' -f 1`
> >         ext=".`echo $i|cut -d '.' -f 2|tr [A-Z] [a-z]`"
> >         echo "$i : $name$ext"
> > #       mv "$i" "$name$ext"
> > done
> >
> > Assuming that your filenames don't have '.' in the name other than
> > to denote extension.
> >
> > Todd
> 
> Thanks Todd, this looks more like what I want, have a slight problem
> though as shown below with the output:
> 
> usr/local/bin/chgcase: line 4: Â : command not found
> /usr/local/bin/chgcase: line 5: Â : command not found
> /usr/local/bin/chgcase: line 6: Â : command not found
> [EMAIL PROTECTED] ACDC - High Voltage]$
> 
> Made it executable, made a symbolic link from /home/chris to
> /usr/local/bin.  When run chgcase *.MP3 *.mp3 the output is as above. 
> I'm sure I've used this script before but I don't remembe how.
> 
> Thanks
> Chris

Hi Chris,

You don't have to add any arguments to the script I wrote, just run it.
Note that it will change the extension for *all* files in the directory,
so .DOC > .doc, .PDF > .pdf etc. I sent another script that hasn't been
distributed yet for *just* .MP3 to.mp3. Here it is again in case it got
lost.

#/bin/bash
for i in *.MP3
do
        name=`echo $i |sed s/'.MP3'//`
        ext=".mp3"
        echo "$i : $name$ext"
#       mv "$i" "$name$ext"
done


-- 
Let us be utopian for a moment so that when we get realistic again it
is not that "realism" so useful to the Establishment in discouraging
action. -Howard Zinn

Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to