Spaces in file names



OK, here's the problem. I need to automatically manipulate the file names
of a number of files whose filenames have spaces in them. I'm not the one
who creates the files (nor is any human) and they must continue to have
spaces in the filenames, so getting rid of the spaces is not an option. I
need to be able to put the filenames string into a variable, manipulate the
variable,a nd then use the new string to rename the file. Ordinarily I
would do something like:

for file in `ls -1 *`
do
<do stuff>
done

Doing so, however, results not in 1 iteration of the loop with a value for
$file of "This is the first file", but rather 5 iterations of the loop with
values of "This", "is", "the", "first", and "file", respectively. How can I
load the entire file name into the variable? I tried using find instead of
ls, but doing so using stdout winds up with the same result. I thought of
using find to execute a subroutine, but the subroutine would take the spaces
to mean each word was a different command line parameter. That wouldn't be
so bad, except the number of words in the file name is variable, and I can't
think off the top of my head of an easy way to handle a random number of
command parameters.


.