title: Download all files of a certain type without directories
body: <p>I am trying to download all ".m4a" podcast files from this base URL "<a href="http://runawaypodcast.com/wp-content/uploads/2014/" rel="nofollow">http://runawaypodcast.com/wp-content/uploads/2014/</a>" and ignore ones that have already been downloaded.</p>
  
  <p>This is my current code (it doesn't search subdirectories)</p>
  
  <pre><code>#!/bin/bash
  lynx --dump 'http://runawaypodcast.com/wp-content/uploads/2014/01/' | awk '/http/{print $2}' &gt;&gt; temp.txt
  while read link || [[ -n "$link" ]]; do
      if [[ $link == *m4a ]]
      then
          if grep -q $link usedlinks.txt; then
              echo "This episode has already been downloaded!"
          else
              wget $link
              echo $link &gt;&gt; usedlinks.txt
          fi
      else
          echo "Non-audio file detected!"
      fi
  done &lt; temp.txt
  rm temp.txt
  </code></pre>
  
  <p>(I would also like to rename the downloaded files to a certain pattern, I don't know if you could help with that, too?)</p>