Replace Windows command FTP -s:E:\FtpScript.txt with SFTP? [duplicate]

偶尔善良 提交于 2019-12-23 03:55:19

问题


I have the following Windows script that connects to a regular FTP server and downloads files.

However, the files have since been moved to an SFTP server. How can I modify the following script so that it connects to this new secure ftp server? I really don't want to modify too much since it had been working correctly with the past FTP server.

The ftp client I'm using here is the one that's included with Windows.

I'm including the script:

I have a Windows task that runs the following: ftp -s:C:\files\FtpScript.txt

FtpScript.txt has the following contents:

open web.myserver.com 8021
username
password
lcd /Data/2014/0113
prompt
get /var/opt/Data1200.xml
get /var/opt/Data1300.xml
get /var/opt/Data1400xml

回答1:


Windows command line FTP client does not support SFTP protocol.

You can switch to WinSCP:

  • replace your command line with:

    winscp.com /script=C:\files\FtpScript.txt
    
  • replace your connection and authentication commands with:

    open sftp://username:password@web.myserver.com/
    
  • the lcd can stay (though /Data/2014/0113 does not look like a local path)

  • in WinSCP the get needs a target path, use .\ to download to the local current working directory.
  • add the exit command

For details, see Secure FTP using Windows batch script or WinSCP guide for Converting Windows FTP script to WinSCP SFTP script

(I'm the author of WinSCP)



来源:https://stackoverflow.com/questions/21102193/replace-windows-command-ftp-se-ftpscript-txt-with-sftp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!