1.下载Winscp4.2.7并安装,地址就不贴了,google一下应该很多.
2.安装完毕后,先使用图形化登陆一次,获得Linux服务器密钥缓存...[这一步不要遗漏],并保存改设置.
3.编写自动同步脚本文件
# winscp.exe /console /script=sample.txt
# Automatically answer all prompts negatively not to stall
# the script on errors
# option echo on|off
option echo off
# option batch on|off|abort|continue
option batch on
# option confirm on|off
option confirm off
# option transfer binary|ascii|automatic
# option synchdelete on|off
# option exclude clear |
# option include clear |
# open [ sftp|ftp|scp:// ][
# open user:[email protected]
# Connect FTP地址
open user:pwd@ip
# Change remote directory
# cd /home/user 转到远程目录
cd /root
# Change local directory
# set to Self's working dir 设置需要同步到远程FTP的本地文件目录
lcd E:\files
# Force binary mode transfer
option transfer binary
# Download file to the local directory d:\
# get examplefile.txt d:\
# option synchdelete on|off
option synchdelete off
# option include clear |
# option include /2008-*-*/;/2009-*-*/;/2010-*-*/;/2011-*-*/;/2012-*-*/;/2013-*-*/
# synchronize local|remote|both [
synchronize local
# Disconnect
close
# Exit WinSCP
exit
4.编写bat文件
"%winscp setupPath%\Winscp.exe" /console /script=同步脚本文件绝对路径
5.放到windows计划任务里面
完成...