[SWLUG] Find And Replace.

Andrew Jenkins adjenkins at gmail.com
Thu Jan 7 14:44:55 UTC 2010


Marcus.Davage at googlemail.com wrote:
> Try this in a script...
>
> #!/bin/bash
> for i in $( ls *.mp3 );
> do
> src=$i
> tgt=$(echo $i | sed -e "s/-/ - /")
> mv $src $tgt
> done
>
> Marcus
>
It was something like that I did last time and
that's similar to what I was trying earlier. It
gives simiilar results to what I was getting;

e.g.

Aerosmith-Amazing.mp3
Aerosmith-Boogie Man.mp3
Aerosmith-Can't Stop Messin'.mp3

Running the above script gives;

mv: target `Amazing.mp3' is not a directory
mv: target `Boogie' is not a directory
mv: cannot stat `Man.mp3*': No such file or directory
mv: target `Can\'t' is not a directory
mv: cannot stat `Stop': No such file or directory
mv: cannot stat `Messin\'.mp3*': No such file or directory

Maybe I'm thick but I can't see what's happening.

Andy Jenkins.


-- 
Microsoft have broken Volkswagen's world record: Volkswagen only made 
22 million bugs!





More information about the Swlug mailing list