Got stuck
Ralph W. Reid
rreid at sunset.net
Sun Dec 31 01:21:30 EST 2006
I don't know if you got a satisfactory response to your need yet, but
I decided to try writing a script which did what you asked. I put the
script on my web site at
http://personalweb.sunset.net/~rreid/linux/rename_dashes_to_underlines.sh
This script changes the dashes (-) to underlines (_) in directory and
file names in the entire subdirectory tree from wherever you run it.
If an invalid command line parameter is given (or try -h), a brief
help screen will be displayed. More features could probably be added
to this script, but it should do the trick for what you are looking
for.
HTH, and have a great year.
On Sat, Dec 30, 2006 at 07:40:42AM -0500, Pawel Loba wrote:
> 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.
--
Ralph. N6BNO. Wisdom comes from central processing, not from I/O.
rreid at sunset.net http://personalweb.sunset.net/~rreid
...passing through The City of Internet at the speed of light!
COSEC (x) / SEC (x) = (COTAN (x) / TAN (x)) ^ 2
More information about the Speakup
mailing list