[GRLUG] Shell script needed

john-thomas richards jtr at jrichards.org
Tue Jul 3 16:05:39 EDT 2007


On Tue, Jul 03, 2007 at 03:08:00PM -0400, Marc Zuverink wrote:
> I am looking for a shell script to run on my /music.  It needs to
> replace all capital letters in all sub dirs of /music and replacing
> capital letters with lowercase replace all spaces with underscore in
> both the sub dirs and the enclosed files.
> 
> Help with this would really be appreciated!

This one will change the spaces to underscores:

#!/bin/sh
for i in `find $1* -type f -name *.ogg`; do mv "$i" `echo $i | tr ' ' \
'_'`; done

(should be one line; vim wraps at 72 characters for me)

If you do not use a free music format, you will need to change the .ogg
to the appropriate extension.

:-)
-- 
john-thomas
------
Selfish, adj. Devoid of consideration for the selfishness of others.
Ambrose Bierce (1842-1914), [The Devil's Dictionary, 1906]


More information about the grlug mailing list