windows - 我无法通过批处理脚本将多个文件上传到 FTP

标签 windows batch-file cmd ftp automation

我无法通过我制作的批处理文件将多个文件成功上传到某个 FTP。

另外,我想从这个本地目录上传所有文件。

代码:

ftp -s:"C:\automation\fileup.bat" MYSERVER.COM
USERNAME
PASSWORD
ascii
cd "/public_html/reports/"
lcd "C:\automation\tests\HtmlReporter"
mput *
close
quit

错误:

C:\automation>ftp -s:"C:\automation\fileup.bat" MYSERVER.COM
Connected to server26.000webhost.com.
220---------- Welcome to Pure-FTPd [privsep] ----------
220-You are user number 12 of 500 allowed.
220-Local time is now 07:03. Server port: 21.
220-This is a private system - No anonymous login
220 You will be disconnected after 3 minutes of inactivity.
User (MYSERVER.COM:(none)):
331 User USERNAME OK. Password required

230-OK. Current restricted directory is /
230-109 files used (1%) - authorized: 10000 files
230 14084 Kbytes used (0%) - authorized: 1536000 Kb
ftp> ascii
200 TYPE is now ASCII
ftp> cd "/public_html/reports/"
250 OK. Current directory is /public_html/reports
ftp> lcd "C:\automation\tests\HtmlReporter"
Local directory now C:\automation\tests\HtmlReporter.
ftp> mput *
mput 000500de-0092-0095-00d9-00a100f000f7.json? close
mput 00090020-0041-007c-00db-00b9003c0085.json? quit
ftp>

我尝试上传的文件:

enter image description here

最佳答案

使用 prompt command关闭传输确认提示:

Toggles prompt mode on and off.

没有它,tje ftp 使用脚本中的以下命令(在您的例子中是 closequit)作为答案。由于它们不是 y,因此将跳过传输。


另一个具有相同效果的选项是在 ftp command-line 上使用 -i 开关:

-i : Disables interactive prompting during multiple file transfers.

关于windows - 我无法通过批处理脚本将多个文件上传到 FTP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30370194/

相关文章:

c# - Windows Server 2003 到 2008 sslstream 无通用算法

python - 使用 Python 在 Windows Server 2012 上远程编辑文件

batch-file - 复制路径中带有通配符的文件

windows - 如何使用批处理脚本仅获取修改年份?

windows - 用于搜索和替换字符串的批处理文件

Windows 用户环境变量与系统环境变量

android - 如何避免回车线馈送对

linux - 使用变音符号导出 CSV 会导致输出中出现奇怪的字符

c++ - Windows 包含文件夹中缺少 vcruntime.h?

bash - 带时间戳的 Mysql 转储