On Thu, 07 Jun 2007 08:18:51 +0100, luxxius <[EMAIL PROTECTED]> wrote:
> Tony Arnold wrote:
> <snip>
>> for i in `find /home/diana/music -group diana` ; do chgrp root $i &&
>> chmod 644 $i; done
>> (should be all on one line, excuse the wrap)
> 
> 
> Tony / Matthew / Robert >>> Many thanks for your quick and very helpful
> replies.
> 
> I've tried Tony's one-liner, which would work a treat with orthodox file
> names.  Sadly, a lot of mine are from CD rips, and contain spaces.  So
> the suggested script gags on the un-escaped spaces.  Rats!
> 
> Looks like I may have to do them by hand after all.
> 
> Thanks ever so much for the ideas, though, as I now know about 300%
> about how to do this than I did a couple of hours ago.  What a great list!

Not the one I originally used, but a good example all the same:

http://tlug.dnho.net/?q=node/198

gives:

#!/bin/sh
for i in ./* ; do
        if [[ `echo "$i" | grep -r '_' | grep -v 'm3u'` ]]
        then
        #       mv "$i" "`echo "$i" | sed 's/_/\ /g' | perl -p -e 
's/(\\w+)/\\u\\L$1/g;' | sed 's/Mp3/mp3/g'`";
                echo "`echo "$i" | sed 's/_/\ /g' | perl -p -e 
's/(\\w+)/\\u\\L$1/g;' | sed 's/Mp3/mp3/g'`";
        fi
done


The above script will give test output to ensure that this is what you want, to 
make the changes, do the following:

#!/bin/sh
for i in ./* ; do
        if [[ `echo "$i" | grep -r '_' | grep -v 'm3u'` ]]
        then
               mv "$i" "`echo "$i" | sed 's/_/\ /g' | perl -p -e 
's/(\\w+)/\\u\\L$1/g;' | sed 's/Mp3/mp3/g'`";
        #      echo "`echo "$i" | sed 's/_/\ /g' | perl -p -e 
's/(\\w+)/\\u\\L$1/g;' | sed 's/Mp3/mp3/g'`";
        fi
done


If you put this into a file called "rename.sh" and chmod +x rename.sh you can 
then run the script (./rename.sh)

Hope this helps,

Matt

--
Matthew Macdonald-Wallace
Lug-Master (http://www.thanet.lug.org.uk),
Dad (http://www.helpmeimadad.com/),
Ubuntu User( http://www.ubuntu.com/)


-- 
ubuntu-uk@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
https://wiki.kubuntu.org/UKTeam/

Reply via email to