TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TCLUG:18790] quick way to strip spaces...





On Fri, 9 Jun 2000, Brian Ackermann wrote:

> anybody got a quick way strip spaces from a filename, preferably one that
> will do globbing and perhaps recursion?
> 
> I've got a whole bunch of mp3 uploaded to my new RIMPS server, from various
> places, and I'd really like to eliminate the spaces in the names.  Rimps
> works just fine with them, but its troublesome to me...

for i in `find -name *.mp3`; do mv $i `echo $i | sed s/\ /-/`; done

That should replace spaces with -'s.  Some prefer _'s, but I hate having to
hit shift all day ;)

It also recurses, etc.  You can pop in an echo $i before the mv to see the
progress as it goes as well.

Anyhow, have at it.. there's my scriptlet for the day.

-David