title: Remove folders based on naming pattern
body: <p>I have a list of 400 folders with the following pattern:</p>
  
  <blockquote>
  <pre><code>backup_01_01_2013/
  backup_01_02_2013/
  backup_01_03_2013/
  ...
  backup_08_25_2014/
  </code></pre>
  </blockquote>
  
  <p>A new folder is created every day via a cron job.</p>
  
  <p>I want to delete all folders EXCEPT:</p>
  
  <ul>
  <li>Keep the 30 most recent folders</li>
  <li>Keep the first of every month</li>
  </ul>
  
  <p>How can I delete all the unnecessary folders using Bash in Linux?</p>