1#!/bin/bash 2USAGE="Usage: mirror_file_sftp.sh user@host local_path remote_path" 3 4# command line checks, bash 5if [ $# -ne 3 ]; then 6 echo ${USAGE} 7 exit 0 8fi 9user_host=$1 10local_path=$2 11remote_path=$3 12 13echo Mirroring file ${local_path} to ${user_host}:${remote_path} 14 15# SFTP is very peculiar: recursive put only works for a single directory 16# note: does not work with sftp of OS X 10.11 17sftp ${user_host} << EOF 18 put ${local_path} ${remote_path} 19 quit 20EOF 21rm -rf tmp/${folder} 22