title: Bash script look for a file type in a given folder
body: <p>I have a bit of a problem. I'm trying to write a script that looks for all files of a given type (php) in a given directory. If it doesn't find it, it goes through all the sub-directories in the parent directory. If it finds it then, it performs a given operation and breaks. </p>
  
  <p>Here is what I have so far:</p>
  
  <pre><code>function findPHP(){
    declare -a FILES
    FILES=$(find ./ -type f -name \*.php)
    for f in $FILES
    do
      echo "Processing $f file..."
      # take action on each file.
    done
  }
  </code></pre>
  
  <p>Any ideas?</p>