File: D:/bin/webbackup/ftp_to_ss_server_test.cmd
:: (SS,22/04/14) To test FTP of today's file to home server
d:
cd d:\bin\webbackup
:: now using WinSCP, ftpexe is the path to the app
set ftpexe=d:\bin\winscp\winscp.com
set bakpath=t:\backups
set tmpbakpath=e:\backups
:: set file name
cmddate -s 0 set bakfile=%bakpath%\#.7z>op.bat
call op.bat
rem ==== FTP to home ====
echo ------------------------------------------------------------>>logtoday.txt
echo %date% %time% Start FTP to SS home server >>logtoday.txt
echo.>>logtoday.txt
rem --- build the FTP operations file
:: (SS,5/7/12) for winscp, the open command specifies username and password, and we have to prefix with ftp for normal ftp (see http://winscp.net/eng/docs/scripting)
::echo open ftp://backup:oscaris10@ftp.ontheworldweb.com:5821>ftpop2.txt
:: (SS,12/7/12) replaced above with following for secure connection, certificate fingerprint is also passed
echo open ftps://backup:oscaris10@secure.ontheworldweb.com:5821 -explicittls -certificate="59:80:cb:c7:53:c1:89:7e:ab:75:b9:3d:20:7f:10:8a:e6:61:7d:22">ftpop2.txt
::echo echo on>>ftpop2.txt
echo option batch continue>>ftpop2.txt
echo option confirm off>>ftpop2.txt
echo binary>>ftpop2.txt
cmddate -s 0 put %bakfile%>>ftpop2.txt
echo exit>>ftpop2.txt
rem --- FTP the file to ontheworldweb server
%ftpexe% /script=ftpop2.txt>>logtoday.txt
:: (SS,16/3/13) added following because it was added the "---.." to the same line
echo %date% %time% Finish FTP to SS home server >>logtoday.txt
echo. >>logtoday.txt
rem ==== End of FTP to home ====
pause