Complete.Org: Mailing Lists: Archives: discussion: March 2000:
[aclug-L] Re: Working on file names

[aclug-L] Re: Working on file names

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: discussion@xxxxxxxxx
Subject: [aclug-L] Re: Working on file names
From: Tom Hull <thull@xxxxxxxxxxx>
Date: Wed, 22 Mar 2000 16:03:37 -0600
Reply-to: discussion@xxxxxxxxx

Wayne White wrote:
> I need to remove the blank spaces from a bunch of file
> names (MP3z). I know if it was a list in a text file
> that it would be a simple thing to script bash to do it.
> What I don't know is how to get it to work on the file
> name themselves, or if that can even be done. Would
> anyone like to weigh in with advice?
> thanx, wayne

Sounds like a simple shell script, something like (beware,
not tested):

  ls -d *\ * | while read nm
    new_nm=`echo $nm | sed 's/ /_/g'`
    mv "$nm" "$new_nm"

This changes the spaces to underscores. 

The ls command gives you a list of files in the current
directory that have spaces in the name. You can also use:

  find . -name '* *' -print

 *  Tom Hull * thull@xxxxxxxxxxx *

-- This is the discussion@xxxxxxxxx list.  To unsubscribe,

[Prev in Thread] Current Thread [Next in Thread]