在SAS Enterprise Guide(SAS企业指南)中是否有将SFTP文件从Linux目录发送到Windows的方法?

在SAS Enterprise Guide(SAS企业指南)中是否有将SFTP文件从Linux目录发送到Windows的方法?,sas,enterprise-guide,Sas,Enterprise Guide,我试图使用SAS将文件从Linux SFTP到Windows目录,但我一直遇到错误 我的代码是: filename attn '/<Linux Directory>/file.doc'; filename outfile sftp '/<Linux Directory>/file.doc'; cd ='C:\Temp\file.doc' options="oIdentityFile='~/.ssh/authorized_keys' -oPort=<port num

我试图使用SAS将文件从Linux SFTP到Windows目录,但我一直遇到错误

我的代码是:

filename attn '/<Linux Directory>/file.doc';

filename outfile sftp '/<Linux Directory>/file.doc'; cd ='C:\Temp\file.doc'
options="oIdentityFile='~/.ssh/authorized_keys' -oPort=<port number>" 
host="<hostname>" user="<username>"  DEBUG  ;


data _null_;
infile attn ;
file outfile  ;
input;
put _infile_;
run;
filename attn'//file.doc';
文件名outfile sftp'//file.doc';cd='C:\Temp\file.doc'
options=“oIdentityFile=”~/.ssh/authorized_keys'-oPort=”
host=”“user=”“调试;
数据为空;
填充附件;
文件输出文件;
输入;
把"填入";;
跑
但我一直面临以下错误:

ERROR: Physical file does not exist, /<Linux directory>/file.doc.

NOTE: usage: sftp [-1Cv] [-B buffer_size] [-b batchfile] [-F ssh_config]            [-o ssh_option] [-P sftp_server_path] [-R 
      num_requests]            [-S program] [-s subsystem | sftp_server] host       sftp [user@]host[:file ...]       sftp 
      [user@]host[:dir[/]]       sftp -b batchfile [user@]host

NOTE: cd C:\Temp\task1045v2_13yrs_cc.doc

ERROR: Directory or file C:/temp/file.doc/ doesn't exist.

NOTE: The SAS System stopped processing this step because of errors.
错误:物理文件不存在,//file.doc。
注意:用法:sftp[-1Cv][-B缓冲区大小][-B批处理文件][-F ssh\u配置][-o ssh\u选项][-P sftp\u服务器路径][-R
num_请求][S程序][S子系统| sftp_服务器]主机sftp[用户@]主机[:文件…]sftp
[user@]主机[:dir[/]]sftp-b批处理文件[user@]主机
注:cd C:\Temp\task1045v2\u 13yrs\u cc.doc
错误:目录或文件C:/temp/file.doc/不存在。
注意:由于错误,SAS系统停止处理此步骤。
基本上,我正在尝试在SAS中重新创建以下Visual Basic代码:

open sftp://<userid>:<password>@<hostname> -hostkey="ssh-rsa <Port Number> <key>"
option echo on
option batch on
option confirm off
option transfer ascii
lcd "<Windows path/>" 
cd <Linux path>
get <file.doc> /*the file which need to get transferred from linux to windows*/
close
exit

VB Code (actual code to transfer):

    strPath = "C:\Temp\"
    strFileName = "<filename>.txt"
    strFullName = objFSO.BuildPath(strPath, strFileName)
    strLogName = objFSO.BuildPath(strPath, "<logfilename>.log") 

Set objShell = CreateObject("WScript.Shell")
objShell.CurrentDirectory = strPath

Set objExec = objShell.Exec("""C:\Program Files (x86)\WinSCP\WinSCP.exe"" /console /script=""" & strFullName & """ /log=""" & strLogName & """")

    Set objExec = Nothing
    Set objShell = Nothing
opensftp://:@-hostkey=“ssh-rsa”
选项echo on
选项批处理打开
选项确认关闭
选项传输ascii
液晶显示器“
光盘
获取/*需要从linux传输到windows的文件*/
关闭
出口
VB代码(要传输的实际代码):
strPath=“C:\Temp\”
strFileName=“.txt”
strFullName=objFSO.BuildPath(strPath,strFileName)
strLogName=objFSO.BuildPath(strPath,“.log”)
设置objShell=CreateObject(“WScript.Shell”)
objShell.CurrentDirectory=strPath
设置objExec=objShell.Exec(““C:\ProgramFiles(x86)\WinSCP\WinSCP.exe”“/console/script=”“”&strFullName&”“/log=”“&strLogName&”“)
设置objExec=Nothing
Set objShell=Nothing

如有任何建议,将不胜感激。谢谢大家!

看起来您正在尝试移动名为
file.doc
的文件而不更改其名称。确保告诉SFTP目标机器上要写入文件的正确位置

%let source=/<Linux Directory>;
%let target=C:\Temp;
%let fname=file.doc;

filename attn "&source/&fname";

filename outfile sftp "&fname" cd ="&target\"
  options="oIdentityFile='~/.ssh/authorized_keys' -oPort=<port number>" 
  host="<hostname>" user="<username>"  DEBUG  
;
%let source=/;
%让目标=C:\Temp;
%设fname=file.doc;
文件名附件“&source/&fname”;
文件名输出文件sftp“&fname”cd=“&target\”
options=“oIdentityFile=”~/.ssh/authorized_keys'-oPort=”
host=”“user=”“调试
;

注意:如果一条语句太长,为了便于阅读,您需要将其分成多行,我发现最好将语句结尾的分号放在新行上。就像你要把
结束一样语句。这样可以更容易地发现代码中缺少的分号(或者在您的例子中,额外的分号)。

为什么要在第一个参数之后结束OUTFILE的FILENAME语句?移除额外的分号时会发生什么?为什么在告诉SFTP将文件放在Windows服务器上时,您似乎在尝试使用unix样式的文件名?你真的有一个名为
file.doc
的目录吗?对于目录来说,这似乎是一个奇怪的名称。