a little help with removing spaces from filenames

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: BoBB
Date:  
Subject: a little help with removing spaces from filenames
<begin quote>
for i in *\ *; { mv "$i" $(echo $i | sed 's/ /_/g'); }

This one goes through an entre directory changing all <SPACES> in each filename into underscores "_". Great for mp3s downloaded from goofy windows users.

ie. Madonna - Ray of Light.mp3

becomes: Madonna_-_Ray_of_Light.mp3

It makes dealing with files from the command-line much easier.
<end quote>
that was taken from www.darkbytes.net/html/oneliners.html ... some very cool stuff on www.darkbytes.net including a text book of a book called underground, not done yet but its been great so far :)

On Wed, 7 Aug 2002 22:49:32 -0700
"technomage" <> wrote:

> ok,
> I've read and I've read, but can't seem to come up with a solution that isn't
> overly complex.
> I want t take spaces in filenames and rename them with underscores "_" and
> would like to do so a directory at a time if need be.
>
> any help would be appreciated
>
> Technomage
>
> --
> I will not be pushed, filed, stamped, indexed, briefed, debriefed, or
> numbered!
> My life is my own - No. 6
> ________________________________________________
> See http://PLUG.phoenix.az.us/navigator-mail.shtml if your mail doesn't post to the list quickly and you use Netscape to write mail.
>
> PLUG-discuss mailing list -
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>