title: How do I apply a shell command to many files in nested (and poorly escaped) subdirectories?
body: <p>I'm trying to do something like the following:</p>
  
  <pre><code>for file in `find . *.foo`
  do
  somecommand $file
  done
  </code></pre>
  
  <p>But the command isn't working because $file is very odd.  Because my directory tree has crappy file names (including spaces), I need to escape the <code>find</code> command.  But none of the obvious escapes seem to work: 
    <code>-ls</code> gives me the space-delimited filename fragments
    <code>-fprint</code> doesn't do any better.</p>
  
  <p>I also tried:  <code>for file in "</code>find . *.foo -ls<code>"; do echo $file; done
  - but that gives all of the responses from find in one long line.
  </code></p>
  
  <p>Any hints?  I'm happy for any workaround, but am frustrated that I can't figure this out.</p>
  
  <p>Thanks,
  Alex</p>
  
  <p>(Hi Matt!)</p>