Download Script Not Working

Advertisement

claudia888
Joined:
Posts:
3

Download Script Not Working

Hi ,

I've been using WinSCP on an older computer since 2017, and it has been working great. Now we have a new computer running Windows 11, and I just downloaded the latest version of WinSCP, however the script is not working – and I'm trying to access the same SFTP server, folder and download the same file. Nothing on my SFTP server side changed.

Here's the old script:
option batch on
option confirm off
open backupdb@111.222.333.444
option transfer binary
get /home/backupdb/backup/* c:\ABCBackup\ABCDB\*
exit
I read the WinSCP support and changed the command for open from using site to session url, but it still does not work.

Here is the new script:
option batch on
option confirm off
open sftp://backupdb@111.222.333.444/
option transfer binary
get home/backupdb/backup/* C:\ABCBackup\ABCDB\*
exit
Please let me know if the script is correct? I appreciate your help.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,469
Location:
Prague, Czechia

Re: Download Script Not Working

Your post does not really contain much information.
We need at least any error you are getting or better a log file.
See also https://winscp.net/eng/docs/troubleshooting#scripting

Though in general your script is missing a hostkey. The script might have worked on the old machine, because the host key was cached there. We do not recommend to rely on a cached host keys for this very reason.
See https://winscp.net/eng/docs/scripting#hostkey and
Why WinSCP does not work in a new environment (operating system, machine, user account, network), when it works for me in a different environment already?

Reply with quote

claudia888
Joined:
Posts:
3

Download Script Not Working - 2nd Post

HI Martin,

I read thru the documentation you provided; and added the hostkey to my script; but it still did not work. I have enabled the log as well.

Here is what I did:
  • I accessed the site from WinSCP GUI last night, connected to the remote SFTP server, clicked "Download" and downloaded the file that I needed. The log was created from this action. I read thru the log, and saw the hostkey fingerprint info. So I used it to add to my script.

  • I have already added a Task in Windows Task Scheduler to trigger this script at 3am everyday. I changed the script and added the hostkey last night, and this morning I checked - in Task Scheduler, it shows that the task was started at 3am, action started then completed; but when I looked at the destination folder, no new file was downloaded, also, there was no new log created from this morning either; as if the WinSCP session was never started this morning.
Here is the script I tried:
option batch on
option confirm off
open sftp://backupdb@111.222.333.444/ -hostkey="ssh-ed25519 255 rsgXXXXXXXXXXXXXXXXXXXX"
option transfer binary
get /home/backupdb/backup/* C:\ABCBackup\ABCDB\*
exit
Note: for the command line with open, I have also tried the following format, but neither worked:
open sftp://backupdb@111.222.333.444/ -hostkey="ssh-ed25519 255 SHA256:rsgXXXXXXXXXXXXXXXXXXXX"
Also, I went to WinSCP, have it generated the session url for me, which is in this format -but it did not work either:
open sftp://backupdb;fingerprint=ssh-ed25519-rsgXXXXXXXXXXXXXXXXXX@111.222.333.444/
So at this point, I have read your support docs, tried everything I can think of, but it still does not work, and there is no log – as if the WinSCP session never got started.

Please let me know if you have any suggestions.

Thanks!

Reply with quote

Advertisement

You can post new topics in this forum