Download files from Unix server using WinSCP with get command

自古美人都是妖i 提交于 2019-11-26 17:24:33

问题


I have program in Unix that generates files 8 files at 8:30 pm everyday.

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.

I cannot use .Net assembly to download those.

I have tried to use the get command, but its throwing error: Not an SCCS file.

Let me know how can I solve this.

--Thanks


回答1:


To automate a task using WinSCP, use its scripting interface from a batch file (e.g. download.bat).

I assume you want to use SFTP, as you are connecting to a *nix server.

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"

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.

Though it's easier to have WinSCP generate the batch file for you.

For details see a guide to automating file transfers from SFTP server using WinSCP.


Once you have the batch file working, schedule the the batch file execution using Windows scheduler.

See a guide to scheduling file transfers from SFTP server.



来源:https://stackoverflow.com/questions/32689858/download-files-from-unix-server-using-winscp-with-get-command

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