Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

User1981

many thanks!
User1981

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

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 :)

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:
# 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 :(