使用带有 get 命令的 WinSCP 从 Unix 服务器下载文件 [英] Download files from Unix server using WinSCP with get command
问题描述
我有一个 Unix 程序,每天晚上 8 点 30 分生成 8 个文件.
I have program in Unix that generates files 8 files at 8:30 pm everyday.
在使用 WinSCP 生成文件后,我需要将文件下载到我的 Windows 机器中.
I need to download the files into my Windows machine after the files are generated using WinSCP.
我可以拖放它们,但很耗时,我需要自动化这个过程.
I can drag and drop those but its time consuming, I need to automate this process.
我无法使用 .Net 程序集下载这些.
I cannot use .Net assembly to download those.
我尝试使用 get
命令,但它抛出错误:不是 SCCS 文件.
I have tried to use the get
command, but its throwing error: Not an SCCS file.
告诉我如何解决这个问题.
Let me know how can I solve this.
--谢谢
推荐答案
要使用 WinSCP 自动执行任务,请使用其 脚本界面来自批处理文件(例如download.bat
).
To automate a task using WinSCP, use its scripting interface from a batch file (e.g. download.bat
).
我假设您想使用 SFTP,因为您要连接到 *nix 服务器.
最简单的下载批处理文件如下:
The simplest download batch file is like:
winscp.com /log=c:\path\to\log\winscp.log /command ^
"open sftp://username:password@example.com/ -hostkey=""xxx""" ^
"get /path/to/file.ext c:\path\to\download\to\" ^
"exit"
将username
、password
和example.com
替换为实际的连接详细信息.从您的 GUI 会话中获取 -hostkey
开关 的值.使用真实路径.
Replace the username
, password
and example.com
with the actual connection details. Get the value of -hostkey
switch from your GUI session. Use real paths.
尽管让 WinSCP 为您生成批处理文件会更容易.
有关详细信息,请参阅使用 WinSCP 从 SFTP 服务器自动传输文件的指南.
For details see a guide to automating file transfers from SFTP server using WinSCP.
一旦批处理文件正常工作,请使用 Windows 调度程序安排批处理文件的执行.
Once you have the batch file working, schedule the the batch file execution using Windows scheduler.
这篇关于使用带有 get 命令的 WinSCP 从 Unix 服务器下载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!