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

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

本文介绍了我无法通过批处理脚本将多个文件上传到FTP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



此外,我要上传此本地目录中的所有文件。



代码

  ftp -s:C:\automation\fileup.batMYSERVER.COM 





  USERNAME 
PASSWORD
ascii
cd/ public_html / reports /
lcdC:\automation \ tests\HtmlReporter
mput *
close
quit

错误:

  C:\automation> ftp -s:C:\automation \fileup.batMYSERVER.COM 
连接到server26.000webhost.com。
220 ----------欢迎来到Pure-FTPd [privsep] ----------
220 - 您是用户号码12,允许500。
220-本地时间是07:03。服务器端口:21.
220 - 这是一个私人系统 - 无匿名登录
220您将在3分钟不活动后断开连接。
用户(MYSERVER.COM:(无)):
331用户USERNAME确定。需要密码

230-OK。当前受限目录是/
使用的230-109个文件(1%) - 授权:10000个文件
230 14084使用的KB(0%) - 授权:1536000 Kb
ftp> ascii
200 TYPE现在是ASCII
ftp> cd/ public_html / reports /
250 OK。当前目录是/ public_html / reports
ftp> lcdC:\automation\tests\HtmlReporter
本地目录现在C:\automation\tests\HtmlReporter。
ftp> mput *
mput 000500de-0092-0095-00d9-00a100f000f7.json?关闭
mput 00090020-0041-007c-00db-00b9003c0085.json? quit
ftp>



我尝试上传的档案



解决方案

使用关闭转移确认提示:

没有它, ftp 在脚本中使用以下命令( close 在您的情况下退出)作为答案。因为他们不是 y ,所以跳过传输。






具有相同效果的另一个选项是在:


I can't succeed to upload a multiple files to some FTP by batch file I made.

Also, I want to upload all files from this local directory.

The code:

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

The error:

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>

The files I've trying to upload:

解决方案

Use prompt command to turn off transfer confirmation prompts:

Without it, ftp uses the following commands in the script (close and quit in your case) as answers. As they are not y, the transfer is skipped.


Another option with the same effect is using -i switch on ftp command-line:

这篇关于我无法通过批处理脚本将多个文件上传到FTP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 11:37