Synchronizing our website in Console Mode
FileManager - WinScp have a console mode. See below a example script on how to use it to synchronize your remote website.
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\Nicolas>cd C:\Program Files\WinSCP
C:\Program Files\WinSCP>winscp /console
winscp> option batch on
batch on
winscp> option confirm off
confirm off
winscp> open ftp://login:passord@yourwebsite
Connecting to yourwebsite ...
Connected with yourwebsite. Waiting for welcome message...
Connected
Starting the session...
Reading remote directory...
Session started.
Active session: [1] login@yourwebsite
winscp> synchronize local C:\www /www
Comparing...
Local 'C:\www' <= Remote '/www'
Synchronizing...
Local 'C:\www' <= Remote '/www'
.htaccess | 0 KiB | 0.0 KiB/s | ascii | 100%
index.php | 0 KiB | 0.1 KiB/s | ascii | 100%
license.txt | 14 KiB | 2.1 KiB/s | ascii | 100%
memo | 0 KiB | 2.1 KiB/s | ascii | 0%
images | 0 KiB | 1.4 KiB/s | ascii | 0%
logo_ovh.jpg | 1 KiB | 1.0 KiB/s | binary | 100%
outils.gif | 8 KiB | 1.3 KiB/s | binary | 100%
question.gif | 6 KiB | 1.4 KiB/s | binary | 100%
index.html | 3 KiB | 1.2 KiB/s | ascii | 100%
powered.gif | 6 KiB | 1.4 KiB/s | binary | 100%
quota.cgi | 3 KiB | 1.2 KiB/s | ascii | 100%
memo.html | 0 KiB | 1.1 KiB/s | ascii | 100%
readme.html | 7 KiB | 1.1 KiB/s | ascii | 100%
sitemap.xml | 1 KiB | 1.0 KiB/s | ascii | 100%
sitemap.xml.gz | 0 KiB | 0.8 KiB/s | binary | 100%
wiki | 0 KiB | 0.8 KiB/s | binary | 0%
.htaccess.dist | 1 KiB | 0.8 KiB/s | binary | 100%
COPYING | 17 KiB | 1.2 KiB/s | binary | 100%
README | 0 KiB | 1.3 KiB/s | binary | 100%
VERSION | 0 KiB | 1.3 KiB/s | binary | 100%
...............
If you want to know more about each command, you have to go to the Script Command page.
How to schedule it ?
We need first to create a script file.
# Automatically answer all prompts negatively not to stall
# the script on errors
option batch on
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect using a password
# open user:[email protected]
# Connect
open [email protected]
# Synchronize
synchronize local C:\www /www
# Disconnect
close
# Exit WinSCP
exit
In the synchronize command above :
synchronize local C:\www /www
the “local” option specify that changes from remote directory “/www” are applied to local directory “C:\www”
Here is the documentation of this command.
Save the script to the file example.txt. To execute the script file use the following command.
winscp.exe /console /script=example.txt
And to schedule it, use a software scheduler as for Windows Xp : Scheduled Task.
Reference
Want to know more, it's here