Upload files to Remote server using WinSCP-SFTP and VBScript

Advertisement

srikanth.doddi
Joined:
Posts:
1
Location:
USA

Upload files to Remote server using WinSCP-SFTP and VBScript

HI all,

Firstly forgive me for my ignorance. I am an amateur in WinSCP automation.
I am trying to upload a file which is in my local drive to Remote server. As suggested by someone, I am using the below code in VBScript (.VBS FIle). When I execute this, I am getting an error stating ' The system cannot find the file specified'


Set wshShell = WScript.CreateObject("WScript.Shell")

sftpcmd = "winscp /console /command ""open sftp://username:passowrd#@51.16.4.XX -hostkey=""""ssh-rsa 1024 b5:45:a1:fc:ea:33:61:1c:0a:5d:73:67:b9:XX:XX:XX"""""" ""put C:/Users/doddisri/ParentFolder/Dummy.txt /opt/jass/appresources/insr/tmp/folder/"" ""close"" ""exit"""

wshShell.Run(sftpcmd),1,true

(NOTE: C:/Users/doddisri/ParentFolder/Dummy.txt is my file in local. I have to copy this file into /opt/jass/appresources/insr/tmp/folder/ which in Remote server. I have to upload this file on a daily basis)

I am not understanding why am getting the error. Is it probably because of the way am invoking winscp? I have been trying a lot, but in vain.

Any suggestions would be of great help.

Regards,
Srikanth D

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: Upload files to Remote server using WinSCP-SFTP and VBScript

There's nothing wrong with your command.

Enable logging and attach the log here:

sftpcmd = "winscp /log=c:\path\to\winscp.log /console /command ..."

Reply with quote

Advertisement

You can post new topics in this forum