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

Categories

0 votes
604 views
in Technique[技术] by (71.8m points)

windows - Download files from Unix server using WinSCP with get command

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

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

1 Answer

0 votes
by (71.8m points)

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:[email protected]/ -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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...