Got stuck

Pawel Loba pawel.loba at gmail.com
Sat Dec 30 07:40:42 EST 2006


Hello all.
I need to rename a number of directories (in the range of 1000) and all of 
the mp3 files included in this directories (over 20000). What I want to 
achieve
is to replace all of the dashes with underline sign.
Some time ago I found a script to rename files this way within a given 
directory which looks as follows:

for i in *.mp3;
do
mv "$i" `echo $i | tr "-" "_"`;
done

This script works very well within a given directory but doesn't want to 
work from the top directory witch actually includes this nearly 1000 
subdirectories.
As an example, I'm getting somthing like this:
mv: cannot move `./Kolakowski-Leszek-Klucz-niebieski/01-klucz-niebieski.mp3' 
to `./Kolakowski_Leszek_Klucz_niebieski/01_klucz_niebieski.mp3': no such 
file
or directory

It was suggested to me to replace *.mp3 with `find . -name '*.mp3'`
But unfortunately, it did not work.
I'm not a programmer just a user who tries to be smart, so, please be 
patient and treat me like a newbie. :-)

hope all of you on here have a great new year.
Thanks,
Pawel.





More information about the Speakup mailing list