Skip to content

Instantly share code, notes, and snippets.

@thykka
Created August 26, 2014 12:10
Show Gist options
  • Save thykka/05a1f615e30f044d50cc to your computer and use it in GitHub Desktop.
Save thykka/05a1f615e30f044d50cc to your computer and use it in GitHub Desktop.
:: [ v Config starts v ]
set FTP_hostname=12.34.56.78
:: Your FTP username (cannot be blank)
set FTP_username=1337h4x0r
:: Your FTP password (cannot be blank)
set FTP_password=rosebud
:: Remote folder to upload to (optional)
set FTP_remote_dir=screenshots
:: [ ^ Config ends ^ ]
:: Generate FTP command list ]
echo user %FTP_username%> ftpcmd.dat
echo %FTP_password%>> ftpcmd.dat
if defined FTP_remote_dir (
echo cd %FTP_remote_dir%>> ftpcmd.dat
)
echo put %1>> ftpcmd.dat
echo quit>> ftpcmd.dat
:: Run FTP with command list
ftp -n -s:ftpcmd.dat %FTP_hostname%
del %1
:: Clean up command list and env vars for minimal security
del ftpcmd.dat
set FTP_username=
set FTP_password=
set FTP_remote_dir=
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment