SSIS 經過 WINscp 從SFTP下載文件

1.經過SSIS的process task調用 winscp :C:\Program Files (x86)\WinSCP\WinSCP.exehtml

                  /script="C:\SFTPFile\TEST.txt"session

2.ssh

編寫winscp 代碼:url

 open sftp:// [ ueserid ] :[ password ] @10.ip :22
 get \PBI_landing_Zone\in\ANP\test.txt C:\
 exit
注意: 1.winscp 口令遇到內部關鍵字須要用轉義字符代替(密碼中有+ 須要用  %2B代替spa

  • space: %20 or +
  • #: %23 (number sign/hash)
  • %: %25 (percent sign)
  • +: %2B (plus sign)
  • /: %2F (slash)
  • @: %40 (at sign)
  • :: %3A (colon)
  • ;: %3B (semicolon)

    2.路徑須要定位到最底層不然沒法識別 通配符 * .net

 

3.BAT 文件調用winscp代碼:code

cd C:\Program Files (x86)\WinSCP
winscp.exe /console /command "option batch on" "option confirm off" "open sftp:// [ ueserid ] :[ password ];fingerprint=ssh-dss********-9d@10.[ip]:22" "option transfer binary" "cd \PBI_landing_Zone\in\ANP\" "get test* C:\ " htm

注意: BAT文件中轉義字符是%,跟winscp衝突須要轉義兩次(好比 + 須要寫成 : %%2B)blog

 

 

WINSCP 通配符 :https://winscp.net/eng/docs/library_wildcardip

轉義字符 : https://winscp.net/eng/docs/session_url

 

批處理文件特殊字符:http://www.bathome.net/thread-1224-1-1.html

相關文章
相關標籤/搜索