title: file transfer from 1 remote server to another remote server without downloading file
body: <p>I am trying to write a Bash script on my server (My Server) that will grab a file from one remote server (Source) and copy it to a Dropbox account (Destination). I need to get the file from Source via SFTP and will be copying it to Destination using the Dropbox API (HTTPS). So far I can get the file with:</p>
  
  <pre><code>curl  -k "sftp://Source/file.txt" --user "me:mypasswd" -o "/test/file.txt" --ftp-create-dirs 
  </code></pre>
  
  <p>and then copy it to Dropbox with </p>
  
  <pre><code>curl -X POST https://content.dropboxapi.com/2/files/upload \
      --header "Authorization: Bearer " \
      --header "Dropbox-API-Arg: {\"path\": \"/path/to/file.txt\",\"mode\": \"add\",\"autorename\": true,\"mute\": false,\"strict_conflict\": false}" \
      --header "Content-Type: application/octet-stream" \
      --data-binary @/test/file.txt
  </code></pre>
  
  <p>I'm guessing the "right" way to do this is to pipe the file from Source directly to Destination, but I'm just not sure how to go about putting them together. </p>
  
  <p>This is definitely not my area of expertise, so I don't even know where to start - nested CURL calls? If anyone could point me in the right direction, I'd be most appreciative. </p>
  
  <p><br>
  <strong>UPDATE</strong><br>
  Here's the whole <code>curl</code> command I'm running:</p>
  
  <pre><code>curl -X POST https://content.dropboxapi.com/2/files/upload \
      --header "Authorization: Bearer $token" \
      --header "Dropbox-API-Arg: {\"path\": \"/xfer/chef.txt\",\"mode\": \"add\",\"autorename\": true,\"mute\": false,\"strict_conflict\": false}" \
      --header "Content-Type: application/octet-stream" \
      --data-binary "$(curl  -k "http://marketing.dave0112.com/file.txt" --user "me:mypasswd")"
  </code></pre>
  
  <p>I was having issues with CURL not supporting SFTP so I changed to HTTP while i get that end sorted out. Not sure if that affects anything.</p>