title: CentOS: delete X-days old files using cron
body: <p>I want to delete x-days old <code>.tar</code> &amp; <code>.sql</code> files using cronjob.</p>
  
  <p>I have tried multiple commands but it didn't work.</p>
  
  <p>command such as,</p>
  
  <pre><code>find /path/to/files -type f -mtime +10 -delete
  find /path/to/folder -name '*.sql' -mtime +30 -delete
  find "$FILEDIR" -mtime +14 -delete
  [[ $FILEDIR == /home/abc/* ]] &amp;&amp; find "$FILEDIR" -mtime +14 -delete
  </code></pre>
  
  <p>above commands run perfectly but not deleting anything.
  Need help.</p>