BookmarkSubscribeRSS Feed
Eshan
Calcite | Level 5

Hello  Everybody,

I am trying to download a file to my network drive from a remote SFTP server through logging into WinSCP .

I am trying to use the following code and not sure sure if the syntax is correct, so any help would be appreciated.

%let ftpfile_loc = \\User\folder1\files;

%let dest = \\User\folder1\Dataout;

%sysexec "C:\WinsSCP\WinSCP.exe" /console /script:"&ftpfile_loc\ftpscript.txt" /command "get remotefile.prn &dest\localfile.prn" "close" "exit";

In the above code, is the get command syntax correct?

ftpscript.txt has the following code in it

option batch on

option confirm off

open sftp://user:password@xx.x.xxx.xx.22

cd /folder1/folder2//files

Is there any other way of downloading the file from sftp server, plz let me know, because in the above code, i dont' know how to debug the code?

I am really running out of time on this, so help is much appreciated.

Thanks & Regards

Eshan

1 REPLY 1
LinusH
Tourmaline | Level 20

First, is there a spcific reason to involve SAS in this process?

Second, there is SFTP access method for the FILENAME statement, don't know it will support your requirements, or if it's easier debug. But then you don't need to call external scripts from within SAS.

Data never sleeps

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 711 views
  • 0 likes
  • 2 in conversation