title: Cron job to SFTP files in a directory
body: <p>Scenario: I need to create a cron job that scans through a directory and sftps each file to another machine</p>
  
  <ul>
  <li>bash script : /home/user/sendFiles.sh </li>
  <li>cron interval : 1 minute </li>
  <li>directory: /home/user/myfiles </li>
  <li>sftp destination: 10.10.10.123</li>
  </ul>
  
  <p>Create the cron job</p>
  
  <pre><code>crontab -u user 1 * * * /home/user/sendFiles.sh
  </code></pre>
  
  <p>Create the Script</p>
  
  <pre><code>#!/bin/bash
  /usr/bin/scp -r user@10.10.10.123:/home/user/myfiles .
  #REMOVE FILES AFTER ALL HAVE BEEN SENT
  rm -rf * 
  </code></pre>
  
  <p>Problem: Not exactly sure if that cron tab is correct or how to sftp an entire directory with the cron tab</p>