Skip to content

Instantly share code, notes, and snippets.

@splitice
Created March 15, 2014 07:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save splitice/9563002 to your computer and use it in GitHub Desktop.
Save splitice/9563002 to your computer and use it in GitHub Desktop.
# WinSCP script for uploading a single file
# see http://winscp.net/eng/docs/scripting for documentation on WinSCP scripting
# Automatically abort script on errors
option batch continue
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect to server (change this to match your connection settings)
open sftp://{USERNAME}:{PASSWORD}@{HOST} -hostkey="ssh-rsa 2048 ssh-rsa {HOSTKEY}"
# Change remote directory (change this to the desired directory on your server)
cd /var/www/image/
mkdir %2%
cd %2%
# Upload the file to current working directory
put %1%
# Disconnect
close
# Exit WinSCP
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment