Windows FTP命令行客户端不下载带有mget的所有文件*

时间:2019-03-11 06:12:13

标签: windows batch-file cmd ftp

我使用批处理文件将FTP传输到远程服务器,并尝试使用mget *.*下载特定目录中的所有文件。但是在传输过程中,它不会下载所有文件。

这是我的脚本:

open 192.168.31.93
*user*
*password*
binary
cd *directory*
mget *.*
close

脚本的输出:

ftp> Connected to 192.168.31.95.

open 192.168.31.95
220 i4hp FTP server (Version 1.7.212.2 Tue Apr 21 12:14:46 GMT 1998) ready.
User (192.168.31.95:(none)): ---> 
USER ifour
331 Password required for ifour.
---> 
PASS ifour22
230 User ifour logged in.
ftp> Interactive mode Off .

ftp> prompt
---> binary
TYPE I
200 Type set to I.
ftp> ---> cd /console/i4/work/job/hd/bin
CWD /console/i4/work/job/hd/bin
250 CWD command successful.
ftp> ---> ls
TYPE A
---> PORT 192,168,31,93,16,208
200 PORT command successful.
---> NLST
150 Opening ASCII mode data connection for file list.
file.dbv

errlog

file.db

para.job

job.exp

job.exp.b

.SF.pickupdb.wind

.SF.pickupdb.ptype

.SF.dbnichijor

.SF.dbnichijor2

.SF.db.JOBD.Main

lockfile

.SF.db.JOBD.Main.PP.revc

.SF.db.JOBD.Main.pconect.revc

.SF.db.JOBD.Main.ftype.revc

.SF.db.JOBD.Edit

.SF.db.JOBD.Edit.PP.revc

.SF.db.JOBD.Edit.pconect.revc

.SF.db.JOBD.Edit.ftype.revc

.SF.db.queued.Daemon

.SF.db.JOBD.Main.Pi.fffb0000:0

.SF.db.JOBD.Main.Pi.fffb0000:1

.SF.db.JOBD.Main.Pi.fffb0000:2

.SF.db.JOBD.Main.Pi.fffb0000:3

.SF.db.JOBD.Main.Pi.fffb0000:4

.SF.db.JOBD.Main.Pi.fffb0000:5

.SF.db.JOBD.Main.Pi.fffb0000:6

.SF.db.JOBD.Main.Pi.fffb0000:7

.SF.db.JOBD.Main.Pi.fffb0000:8

.SF.db.JOBD.Main.Pi.fffb0000:9

.SF.db.JOBD.Main.Pi.fffb0000:10

.SF.db.JOBD.Main.fffb09

.SF.db.JOBD.Main.fffb0b

.SF.db.JOBD.Main.fffb0a

.SF.db.JOBD.Main.fffb08

... (lots of files omitted)

226 Transfer complete.
ftp: 34913 bytes received in 0.25Seconds 139.65Kbytes/sec.

---> TYPE I
ftp> ---> mget *.*
TYPE A
---> PORT 192,168,31,93,16,209
---> NLST *.*
---> TYPE I
200 Type set to I.
---> PORT 192,168,31,93,16,210
200 PORT command successful.
---> RETR file.db
150 Opening BINARY mode data connection for file.db (134437620 bytes).
226 Transfer complete.
ftp: 134437620 bytes received in 120.22Seconds 1118.28Kbytes/sec.

---> PORT 192,168,31,93,16,213
200 PORT command successful.
---> RETR file.dbv
150 Opening BINARY mode data connection for file.dbv (42766240 bytes).
226 Transfer complete.
ftp: 42766240 bytes received in 38.36Seconds 1114.89Kbytes/sec.

---> PORT 192,168,31,93,16,221
200 PORT command successful.
---> RETR job.exp
150 Opening BINARY mode data connection for job.exp (14752535 bytes).
226 Transfer complete.
ftp: 14752535 bytes received in 13.25Seconds 1113.40Kbytes/sec.

---> PORT 192,168,31,93,16,222
200 PORT command successful.
---> RETR job.exp.b
150 Opening BINARY mode data connection for job.exp.b (12997544 bytes).
226 Transfer complete.
ftp: 12997544 bytes received in 11.78Seconds 1103.26Kbytes/sec.

---> PORT 192,168,31,93,16,223
200 PORT command successful.
---> RETR para.job
150 Opening BINARY mode data connection for para.job (76751 bytes).
226 Transfer complete.
ftp: 76751 bytes received in 0.22Seconds 350.46Kbytes/sec.

ftp> ---> disconnect
QUIT
221 Goodbye.
ftp> quit

1 个答案:

答案 0 :(得分:0)

Windows命令行... script { commiter = sh(returnStdout: true, script: 'git show -s --format='%aw') echo "Person who commited: ${commiter}" } 客户端中的

mget <mask>命令在内部使用ftp FTP协议命令。您的FTP服务器没有返回NLST <mask>的“点”文件(可能是因为它认为它们是隐藏的)。

您将不得不使用另一个FTP客户端,该客户端不会将文件掩码解析留给服务器。

例如,使用WinSCP FTP client,它将起作用:

NLST *

甚至还有一个guide for converting ftp script to WinSCP script

(我是WinSCP的作者)