我无法成功通过BATCH文件将文件连接并上传到某些ftp。
另外,我想从该本地目录上载所有文件。
请您的帮助!
谢谢。
代码:
@echo off
echo user username>> ftpcmd.dat
echo pass>> ftpcmd.dat
echo cd /public_html/reports/>> ftpcmd.dat
echo mput C:\automation\tests\HtmlReporter\*>> ftpcmd.dat
ftp -n -s:ftpcmd.dat myserver.com
del ftpcmd.dat
echo quit>> ftpcmd.dat
pause
disconnect
bye
错误:
Connected to MYSERVER.com.
220---------- Welcome to Pure-FTPd [privsep] ----------
220-You are user number 23 of 500 allowed.
220-Local time is now 05:30. Server port: 21.
220-This is a private system - No anonymous login
220 You will be disconnected after 3 minutes of inactivity.
ftp> user USERNAME
331 UserUSERNAME OK. Password required
230-OK. Current restricted directory is /
230-111 files used (1%) - authorized: 10000 files
230 17049 Kbytes used (1%) - authorized: 1536000 Kb
ftp> prompt
Interactive mode Off .
ftp> cd /public_html/reports/
250 OK. Current directory is /public_html/reports
ftp> mput C:\automation\tests\HtmlReporter\*
Error opening local file C:\automation\tests\HtmlReporter\..
Error opening local file C:\automation\tests\HtmlReporter\...
200 PORT command successful
看一下这一行:
echo password >> ftpcmd.dat
这实际上不存储password
在dat文件中,但是password_
(_是空格)。尝试在以下位置删除空格>>
:
@回声关闭
echo user username>> ftpcmd.dat
echo password>> ftpcmd.dat
echo /public_html/reports>> ftpcmd.dat
echo mput c:\workspace\automation\HtmlReporter\Test_Report.html>> ftpcmd.dat
echo quit>> ftpcmd.dat
ftp -n -s:ftpcmd.dat servernamet.com
del ftpcmd.dat
pause
disconnect
bye
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句