|
|
|
@ -400,6 +400,23 @@ copy_file_to_location() { # copies a file, using scp if required. |
|
|
|
lcd $fromdir |
|
|
|
put $fromfile |
|
|
|
_EOF |
|
|
|
elif [[ "${to:0:5}" == "sftp:" ]] ; then |
|
|
|
debug "using sftp to copy the file from $from" |
|
|
|
ftpuser=$(echo "$to"| awk -F: '{print $2}') |
|
|
|
ftppass=$(echo "$to"| awk -F: '{print $3}') |
|
|
|
ftphost=$(echo "$to"| awk -F: '{print $4}') |
|
|
|
ftplocn=$(echo "$to"| awk -F: '{print $5}') |
|
|
|
ftpdirn=$(dirname "$ftplocn") |
|
|
|
ftpfile=$(basename "$ftplocn") |
|
|
|
fromdir=$(dirname "$from") |
|
|
|
fromfile=$(basename "$from") |
|
|
|
debug "sftp user=$ftpuser - pass=$ftppass - host=$ftphost dir=$ftpdirn file=$ftpfile" |
|
|
|
debug "from dir=$fromdir file=$fromfile" |
|
|
|
sshpass -p $ftppass sftp $ftpuser@$ftphost <<- _EOF |
|
|
|
cd $ftpdirn |
|
|
|
lcd $fromdir |
|
|
|
put $fromfile |
|
|
|
_EOF |
|
|
|
else |
|
|
|
mkdir -p "$(dirname "$to")" |
|
|
|
if [ $? -gt 0 ]; then |
|
|
|
|