title: Curl FTP Upload only Modified / Changed Files
body: <p>i wrote a bash script to deploy the relevant files to my web server.
  I use curl for the upload mainly because it was pre installed on my mac.</p>
  
  <p>It works fine but i don't want to upload all the files with the deployment because every file is transferred one by one. I did some research in the API documentation of the curl program and on google as well but i did not find any information about an option which let me set curl to only upload modified files.</p>
  
  <p>Has anyone an idea how i can archive this with curl?</p>
  
  <pre><code>#!/bin/bash
  recurse() {
   if [ -z ${var+x} ]; then
      dir=$1
   fi
   for i in "$1"/*;do
      if [ -d "$i" ];then
          echo "dir: $i"
          dir=$i
          recurse "$i"
      elif [ -f "$i" ]; then
          curl --ftp-create-dirs -T $i ftp://server/$dir/ --user username:password
          echo "file: $i"
      fi
   done
  }
  
  recurse stylesheets
  recurse js
  recurse bower_components
  curl --ftp-create-dirs -T index.html ftp://server/$dir/ --user username:password
  </code></pre>
  
  <p>This code loops through my stylesheets / js / bower_components folders and creates all subfolders and uploads all files.</p>