ftp 批处理脚本因找不到远程文件列表而失败

ftp batch script fails with Cannot find list of remote files

我有这个脚本,但它说没有同名的文件,我在这里遗漏了什么?

@Echo Off
Set _FTPServerName=192.168.1.0
Set _UserName=luigal
Set _Password=*****
Set _LocalFolder=C:\Users\rs\Desktop\fold_1848E\
Set _RemoteFolder=/pools/A/A0/Backups/lgal
Set _Filename=Readme.txt
Set _ScriptFile=ftp1
:: Create script
 >"%_ScriptFile%" Echo open %_FTPServerName%
>>"%_ScriptFile%" Echo %_UserName%
>>"%_ScriptFile%" Echo %_Password%
>>"%_ScriptFile%" Echo lcd %_LocalFolder%
>>"%_ScriptFile%" Echo cd %_RemoteFolder%
>>"%_ScriptFile%" Echo binary
>>"%_ScriptFile%" Echo prompt
>>"%_ScriptFile%" Echo mget %_Filename%
>>"%_ScriptFile%" Echo quit
:: Run script
ftp -s:"%_ScriptFile%"
Del "%_ScriptFile%"
pause

谢谢

正如您在 script output you've shared this us 中看到的那样,您尝试从以下位置下载 Readme.txt 的目录中根本没有文件:

ftp> ls
200 PORT command successful
150 Opening ASCII mode data connection for file list
226 Transfer complete

如果有任何文件,列表将显示在 150226 消息之间。


我看到你使用了 tag. Yet you use the mget command. That's for download. Maybe you wanted to use the mput, which is for upload (or actually the put,因为你没有使用通配符)。


不过请注意,您的 lcd command 失败了,因此您不在您(可能)想要从中上传文件的目录中。

ftp> lcd C:\Users\... (obfuscated) ...
\Users\ ... (obfuscated) ...: File not found