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

[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
  do
    new_nm=`echo $nm | sed 's/ /_/g'`
    mv "$nm" "$new_nm"
  done

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 * http://www.ocston.org/~thull/
 */

-- This is the discussion@xxxxxxxxx list.  To unsubscribe,
visit http://tmp2.complete.org/cgi-bin/listargate-aclug.cgi


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