[aclug-L] Re: Working on file names
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
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
|
|