"WinSCP is an open source free SFTP client, FTP client, WebDAV client and SCP client for Windows. Its main function is file transfer between a local and a remote computer. Beyond this, WinSCP offers scripting and basic file manager functionality."
Code: Select all
// This macro instructs WINSCP to mirror from the PC to the Internet website.
// The entire directory/subdirectory structure on the PC will be replicated online.
// New or updated files on the PC will be uploaded to the website.
// Files on the website, but not on the PC, will be deleted.
Let>ignorespaces=1
let>script=%desktop_dir%\script.tmp
let>logfile=%desktop_dir%\logfile.log
// delete any existing script/log
DeleteFile>%script%
DeleteFile>%logfile%
// define WinSCP executable
let>winscp="C:\Program Files (x86)\WinSCP\WinSCP.com"
// Generate script file
writeln>script,result,option batch abort
writeln>script,result,option confirm off
Let>username=webmaster
Let>password=SupportMS
Let>website=at-ms-fundraiser.com
writeln>script,result,open ftp://%username%:%password%@%website%/
gosub>addsync,m:,wwwroot
writeln>script,result,exit
// Execute script file/display log file
Let>rp_wait=1
Run>%winscp% /script=%script% /log=%logfile%
Run>Notepad %logfile%
Exit
// Add sync command line to script file
SRT>addsync
Let>from=%sync_var_1%
Let>to=%sync_var_2%
// synchs from local to remote, deletes files on remote that are not on local, filemask excludes specified local/remote files from processing
Let>fm=-filemask="|web.config; Thumbs.db; default.aspx; $RECYCLE.BIN/; System Volume Information/; cgi-bin/"
writeln>script,result,synchronize remote -delete -criteria=both %fm% "%from%" "%to%"
END>addsync