我需要从命令行连接到使用隐式 TLS、用户名和密码保护的 FTP,以便稍后创建批处理。我正在使用 WinSCP,因为它是最受欢迎的(我认为),或者根据广泛的谷歌搜索,我可以使用它来实现这一目标。我不是专家,但阅读了我目前拥有的文档,但从命令提示符连接不成功:
winscp> open username:password@host:port -implicit -certificate="aa:aa:aa:aa..."
连接后,我需要将其中的所有内容提取到文件夹\hostname\folder 或 c:\folder,然后删除 ftp 上的文件(或多或少类似于剪切)
最佳答案
感谢 Martin Prikryl 的更正,我得以连接,这是我所做的:
使用 winscp.com 命令“connection.txt”创建了一个文本文件:
# Automatically abort script on errors
option batch abort
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect with username and password
open ftp://username:password@host:port -implicit -certificate="aa:aa:aa:aa...."
# Change local directory
lcd C:\local_working_folder
# Force binary mode transfer
option transfer binary
# Download missing files to local directory from remote
synchronize local
# Delete all remote files
rm *
# Disconnect
close
# Exit WinSCP
exit
现在从命令提示符或批处理文件中,您只需从安装位置调用 winscp.exe。如果来自安装媒体,它应该是 C:\
C:\WinSCP\WinSCP.exe /console /script="connection.txt" /log="conn.log"
然后只需安排批处理以自动执行该过程。
关于windows - 在 Windows 中使用 WinSCP 或其他命令行 FTP 客户端的隐式 TLS FTP 连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23376244/