Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
598 views
Welcome To Ask or Share your Answers For Others

1 Answer

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:pathologwinscp.log /command ^
    "open sftp://username:password@example.com/ -hostkey=""xxx""" ^
    "get /path/to/file.ext c:pathodownloado" ^
    "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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...