title: Bash script to verify backup folder existence
body: <p>I am trying to create a method that would verify my backup procedure.</p>
  
  <p>There is a folder with backups (snapshots) /mnt/backup/snapshots/ that are taken daily.  Each backup is represented by a folder with a following name:</p>
  
  <blockquote>
    <p>snapshot-YYYYMMHH-HHMMSS-TOKEN-TTTTTTTTTTTTTTTTTTTTTTTTTTTTT</p>
  </blockquote>
  
  <p>where YYYYMMHH-HHMMSS represent the time when snapshot was initiated. Additionally, if the snapshot was taken correctly there will be an empty 'completed' file in the folder.</p>
  
  <p>Examples:</p>
  
  <pre><code>root@SPTestCache000:~# ls -l /mnt/backup/snapshots/
  total 8
  drwxr-xr-x 17 root root 4096 2011-10-12 09:29 snapshot-20111012-092902-TOKEN-11610563189691354026753564484829291576
  drwxr-xr-x 13 root root 4096 2011-10-12 10:08 snapshot-20111012-100827-TOKEN-11610563189691354026753564484829291576
  root@SPTestCache000:~# ls -l /mnt/backup/snapshots/snapshot-20111012-092902-TOKEN-11610563189691354026753564484829291576/
  drwxr-xr-x 2 root root 4096 2011-10-12 09:29 SomeTest
  -rw-r--r-- 1 root root   18 2011-10-12 09:29 completed
  </code></pre>
  
  <p>I would like to have a bash script that could be run in regular intervals (cron) and it would check the following:
  - is there a snapshot folder that is NOT OLDER than X hours. If such snapshot folder exists - does it have the completed file inside?
  - otherwise throw an error</p>
  
  <p>Do you have any suggestions especially for how to do the NOT OLDER than X hours check?</p>