WinSCP command to connect to FTP server to get/put files
来源:互联网 发布:java 加载 xml 编辑:程序博客网 时间:2024/04/29 02:08
reference :
http://winscp.net/eng/docs/commandline#scripting
http://marionote.wordpress.com/2009/12/12/winscp-script-sample/
http://toastergremlin.com/?p=371
http://winscp.net/tracker/show_bug.cgi?id=197
http://winscp.net/forum/viewtopic.php?t=7960
1.FTP connection and operation : FTPscripts.txt
# Automatically abort script on errorsoption batch abort# Disable overwrite confirmations that conflict with the previousoption confirm off# Connect using a password# open sftp://user:password@example.com/ -hostkey="ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"# Connectopen sftp://user:password@example.com/# Change remote directory :%1% is passed-in parametercd %1%# Force binary mode transferoption transfer binary# Download file abc.txt to the local directory d:\abc\ : "get abc.txt d:\abc\" get %3% %2%# If you want to rename/remove the remote filename after uploading:#mv %3% aa.txtrm %3%# Disconnectclose# Exit WinSCPexit#pause
2.batch script : GetDataFileFromFTPServer.bat
D:\zkoo\winscp553\winscp.exe /script=D:\xding\WINSCPscripts\FTPscripts.txt /parameter """/DCCEU/TX EU/BIN/TMS Call Update/""" C:\SSIS\TMSCallUpdate\ TmsCallUpdate*.csv /log=D:\xding\WINSCPscripts\aa.log1) 3 parameters here :
%1% : remote folder - """/DCCEU/TX EU/BIN/TMS Call Update/""", there is space, so use 3 quotes. don't know why???
%2% : destination folder - C:\SSIS\TMSCallUpdate\
%3% : download file name - TmsCallUpdate.csv
2)/log=D:\xding\WINSCPscripts\aa.log
sample to write to dynamic log file: testLog.bat
setlocalset LogPath=.\set LogFileExt=.logset LogFileName=Daily Backup%LogFileExt%::use set MyLogFile=%date:~4% instead to remove the day of the weekset MyLogFile=%date%set MyLogFile=%MyLogFile:/=-%set MyLogFile=%LogPath%%MyLogFile%_%LogFileName%If NOT Exist "%MyLogFile%" goto:noseparatorEcho.>>"%MyLogFile%"Echo.===================>>"%MyLogFile%":noseparatorecho.%Date% >>"%MyLogFile%"echo.%Time% >>"%MyLogFile%":startbatchD:\zkoo\winscp553\winscp.exe /script=TMSCallUpdateDataFile_FTP.txt /log="%MyLogFile%"
3.command line to replace the above
D:\zkoo\winscp553\winscp.exe /command "open sftp://name:password@IPaddress" "cd /FTP_DXY" "option ""transfer binary""" "get 1234*.txt D:\xding\ftp_dxy\ /log="D:\winscp.log"" "close" "exit"
0 0
- WinSCP command to connect to FTP server to get/put files
- maven/jekinsFailed to connect to repository : Command
- send files to a ftp server in PERL
- Android开发 之 Connect to FTP server example
- Word Press提示Fail to connect FTP server
- Error -27796: Failed to connect to server
- unable to connect to converter enterprise server
- SQL Server connect to MySQL
- cannot connect to X server
- put file from local to remote server
- wifi command line connect to ap
- Unable to connect to Command Metric Stream.解决方案
- Hystrix仪表盘--Unable to connect to Command Metric Stream
- How to get Android local files URI
- Error: Failed to connect to MySQL server: DBI connect(';
- ERROR: Failed to connect to MySQL server: DBI connect(';mysql_read_default_file
- ftp connect: No route to host 解决方案
- ftp: connect: No route to host
- 榴莲核的作用和功效有哪些
- oracle重建索引
- ios 渐变色
- 了解上司对你的期望
- “家园”完成后的反思
- WinSCP command to connect to FTP server to get/put files
- struts2页面中获取url参数方法
- 浅谈HTTP中Get与Post的区别
- hdu 无题II(二分差值+最大匹配)
- UIButton点击缩放或禁止缩放
- HDU 3501 Calculation 2---欧拉函数扩展
- spring配置文件详解(applicationContext.xml详解)
- Hbase 之 scan
- Java的位运算符详解实例——与(&)、非(~)、或(|)、异或(^)