Skip to content

Instantly share code, notes, and snippets.

@ObeeWanKenobee
Last active July 31, 2018 06:39
Show Gist options
  • Save ObeeWanKenobee/7717275960a06cc4c5a2b27ffb8cc66a to your computer and use it in GitHub Desktop.
Save ObeeWanKenobee/7717275960a06cc4c5a2b27ffb8cc66a to your computer and use it in GitHub Desktop.
Try this. Save as "sftp.sh" file
transfer 600+ tb from remote to local. requested by mark heramis
#!/usr/bin/sh
USER=username
PASS=password-eh-alangan
URL=ip-sa-site-127.0.0.1
PORT=27
DEST=/local/path/
FILES=/file/*
LOG_DATE="`date +%Y-%m-%d-%H.%M.%S `"
LOG=/path/log/${LOG_DATE}-FTP.log
echo "Commencing SFTP transfer of ${FILES} from ${URL}:${PORT} to ${DEST} on ${LOG_DATE}." >> ${LOG}
sftp -e "set sftp:passive-mode on && cd ${DEST} && put ${FILES} && bye" -u ${USER},${PASS},${URL}:{PORT}
echo "SFTP transfer from ${URL}:${PORT} to ${DEST} finished at ${LOG_DATE} system time." >> ${LOG}
echo "we're done here captain!"
sleep 12h #we'll display the bash window for 12hours
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment