This Korne shell script should work (even if you replace
the first line by /bin/sh instead of /bin/ksh) .
It finds all the file with a blank under the current directory
(and recursively) and rename them with an "_".
Be careful not to forgot the space between the 2 '.*' patterns .
#!/bin/ksh -p
find . | grep '.* .*' | while read F
do
NF=$(echo "$F" | sed -e 's/ /_/')
echo "Renaming \"$F\" to $NF"
set -x
mv "$F" $NF
set -
done
Jean-Luc
Newacct wrote:
> I got many files that have spaces in them.,
> I want to rename all the files with a space and replace to them with "_"
> chracter
> like: file file.ram to> file_file.ram
> how can i do this? I got many files over 200!
> thx people
>
> ------------------------------------------------------------------------
> Want to buy your Pack or Services from MandrakeSoft?
> Go to http://wwww.mandrakestore.com
Want to buy your Pack or Services from MandrakeSoft?
Go to http://wwww.mandrakestore.com