我正在使用WinSCP自动从FTP服务器获取。该日志显示该文件已下载到我指定的目录,但它不在目录中。
这是调度程序参数。
/log="C:\TEST\Automation\WinSCP.log" /ini=nul /command "open
sftp://HIDDEN:NOTTHATDUMB@ftplocation.com/ -rawsettings TryAgent=0
AuthGSSAPI=0" "put C:\TEST\Automation\*.pgp -nopreservetime -nopermissions"
"get /Inbox/* C:\TEST\Automation\NewFolder" "exit"
日志读取就好像文件已下载但无法找到文件。
日志输出:
> 2018-05-23 12:07:50.077 Script: get /Inbox/* C:\TEST\Automation\NewFolder
. 2018-05-23 12:07:50.077 Listing directory "/Inbox".
> 2018-05-23 12:07:50.077 Type: SSH_FXP_OPENDIR, Size: 15, Number: 523
< 2018-05-23 12:07:50.155 Type: SSH_FXP_HANDLE, Size: 10, Number: 523
> 2018-05-23 12:07:50.155 Type: SSH_FXP_READDIR, Size: 10, Number: 780
< 2018-05-23 12:07:50.233 Type: SSH_FXP_NAME, Size: 164, Number: 780
> 2018-05-23 12:07:50.233 Type: SSH_FXP_READDIR, Size: 10, Number: 1036
< 2018-05-23 12:07:50.280 Type: SSH_FXP_STATUS, Size: 50, Number: 1036
< 2018-05-23 12:07:50.280 Status code: 1
> 2018-05-23 12:07:50.280 Type: SSH_FXP_CLOSE, Size: 10, Number: 1284
. 2018-05-23 12:07:50.280 FILENAME.txt;-;163487;2018-05-23T16:06:50.000Z;3;"200" [200];"100" [100];rw-------;0
. 2018-05-23 12:07:50.280 ..;D;0;1899-12-30T05:00:00.000Z;0;"" [0];"" [0];---------;0
. 2018-05-23 12:07:50.280 Copying 1 files/directories to local directory "C:\Test\Automation\" - total size: 163,487
. 2018-05-23 12:07:50.280 PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: S (102400); CalcS: No; Mask: NewFolder
. 2018-05-23 12:07:50.280 TM: B; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; InclM: ; ResumeL: 0
. 2018-05-23 12:07:50.280 AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2018-05-23 12:07:50.280 File: '/Inbox/FILENAME.txt' [2018-05-23T16:06:50.000Z] [163487]
. 2018-05-23 12:07:50.280 Copying "/Inbox/FILENAME.txt" to local directory started.
. 2018-05-23 12:07:50.280 Binary transfer mode selected.
. 2018-05-23 12:07:50.280 Checking existence of partially transferred file.
. 2018-05-23 12:07:50.280 Opening remote file.
> 2018-05-23 12:07:50.280 Type: SSH_FXP_OPEN, Size: 54, Number: 1539
< 2018-05-23 12:07:50.327 Type: SSH_FXP_STATUS, Size: 40, Number: 1284
. 2018-05-23 12:07:50.327 Discarding reserved response
< 2018-05-23 12:07:50.421 Type: SSH_FXP_HANDLE, Size: 10, Number: 1539
> 2018-05-23 12:07:50.421 Type: SSH_FXP_FSTAT, Size: 10, Number: 1800
< 2018-05-23 12:07:50.515 Type: SSH_FXP_ATTRS, Size: 37, Number: 1800
. 2018-05-23 12:07:50.515 Confirming overwriting of file.
> 2018-05-23 12:07:50.515 Type: SSH_FXP_READ, Size: 22, Number: 2053
< 2018-05-23 12:07:50.890 Status code: 1
. 2018-05-23 12:07:50.890 15 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packets.
> 2018-05-23 12:07:50.890 Type: SSH_FXP_CLOSE, Size: 10, Number: 4612
< 2018-05-23 12:07:50.890 Type: SSH_FXP_STATUS, Size: 17, Number: 3589
< 2018-05-23 12:07:50.890 Type: SSH_FXP_STATUS, Size: 17, Number: 3845
< 2018-05-23 12:07:50.921 Type: SSH_FXP_STATUS, Size: 17, Number: 4101
< 2018-05-23 12:07:50.921 Type: SSH_FXP_STATUS, Size: 17, Number: 4357
. 2018-05-23 12:07:50.921 Preserving timestamp [2018-05-23T16:06:50.000Z]
. 2018-05-23 12:07:50.937 Transfer done: '/Inbox/FILENAME.txt' => 'C:\Test\Automation\NewFolder' [163487]
. 2018-05-23 12:07:50.937 Copying finished: Transferred: 163,487, Elapsed: 0:00:00, CPS: 493,279/s
> 2018-05-23 12:07:50.937 Script: exit
. 2018-05-23 12:07:50.937 Script: Exit code: 0
. 2018-05-23 12:07:50.937 Closing connection.
. 2018-05-23 12:07:50.937 Sending special code: 12
. 2018-05-23 12:07:50.937 Sent EOF message
这行日志告诉我它已下载,但导航到保存位置会显示一个空文件夹。
. 2018-05-23 12:07:50.937 Transfer done: '/Inbox/FILENAME.txt' => 'C:\Test\Automation\NewFolder' [163487]
有什么想法吗?
答案 0 :(得分:0)
您的get
命令语法说明:将所有文件从/Inbox
下载到本地文件夹C:\Test\Automation
并将其保存到文件NewFolder
。什么能有效地使所有文件相互覆盖。假设NewFolder
文件夹实际上不存在。如果它存在,下载将失败,“不是文件”错误。
您也肯定会使用一些相当旧版本的WinSCP。最近版本的WinSCP会警告你,你可能做错了什么:
您确定要将多个文件传输到目录“C:\ Test \ Automation \”中的单个文件“NewFolder”吗? 这些文件会互相覆盖 如果您确实要将所有文件传输到目录'C:\ Test \ Automation \ NewFolder \',保留其名称,请确保以斜杠终止路径。
另见documentation for get
command:
最后一个参数指定目标本地目录和可选的操作掩码,以便以不同的名称存储文件。 目标目录必须以反斜杠结尾。
解决方案:
NewFolder
文件夹;