On Tue, Mar 14, 2006 at 04:03:44PM -0600, Jordan Peacock wrote:
> Not a terribly difficult problem, but if I can work it without having
> to rename the files first, it'll save a lot of headache. Ed Wilts was
> commenting that to do that I may need something different from 'find'.
> Is there no way to work find so that it allows for spaces?

It's not actually a find problem, it's a shell issue.  i.e., `mkdir
filename with spaces` receives three arguments ("filename", "with",
and "spaces") instead of just one ("filename with spaces").  The
solution, then lies in the shell rather than in find.

I did some quick testing to verify my suggestion this time (I was
sure the double quotes should have handled this...) and it should
work to set IFS (that's the shell's Input File Separator) at the
start of your script, then telling find to use the new separator
rather than its default newlines.  To do this, change the first
couple lines of your script to:

#!/bin/bash
IFS="
"

The rest of it shouldn't need any changes.  Note that the first
double quote must be the last character on the line and the second
one must be the first character on the following line.

Basically what this does is to tell bash that it should only consider
filenames to be separated by newlines, not by spaces (or tabs).  By
default, find prints a newline after each filename, so It Just Works
from there.  (Or at least it should...)

-- 
The freedoms that we enjoy presently are the most important victories of the
White Hats over the past several millennia, and it is vitally important that
we don't give them up now, only because we are frightened.
  - Eolake Stobblehouse (http://stobblehouse.com/text/battle.html)