Topic "found example code, but it won't let me connect"

Author Message
User1981
[View user's profile]

Joined: 2014-06-05
Posts: 3
Location: Germany
hello everyone
i found some example code on the internet, but it won't let me connect to the SFTP.

i've been using FileZilla for SFTP transfers, but am now in the need for some automated scripting. so i came across WinSCP. every day i connect to a remote folder and there are just under 100 files. and every day i'm downloading a dozen from there, and that list of files i need varies by day of week. so i want to automate that Smile

i found this thread here and then copied the script mentioned in there
https://social.msdn.microsoft.com/Forums/office/en-US/a5cef6d8-ee56-45e2-b158-6894648abd00/download-a-file-from-sftp-site-using-vba

but the shell tells me host "username" does not exist. so something must be wrong in the syntax that i copied from there.

this is my script:
Code:

# Connect to the host and login using password
[b]open sftp://user:password.host.com[/b]
# Change the remote directory
cd remotetargetpath
# get all the files in the remote directory and download them to a specific local directory
get *example_pattern*.csv localtargetpath
# Close and terminate the session
exit


what am i doing wrong?
i tried the documentation/help on here, searched for the "open" command, but can't find syntax Sad
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24991
Location: Prague, Czechia
It should be open sftp://user:password@host.com (note the "at" sign).

See https://winscp.net/eng/docs/scriptcommand_open
_________________
Martin Prikryl
User1981
[View user's profile]

Joined: 2014-06-05
Posts: 3
Location: Germany
many thanks!
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License