我需要在Linux1主机上的代码,想通过FTPClient在Linux2主机上,来统计文件行数(文件大于5M);
String[] rt = ftp.doCommandAsStrings("pwd", null); //这个有返回
String help = ftp.listHelp();//看了下,好像不支持wc -l
214-The following commands are recognized.
ABOR ACCT ALLO APPE CDUP ...PASV PORT PWD QUIT... XRMD
214 Help OK.
doCommandAsStrings,顾名思义,只能执行FTP命令。
而且执行在控制连接上返回结果的命令。
doCommandAsStrings
public String[] doCommandAsStrings(String command,
String params)
throws IOException
Issue a command and wait for the reply, returning it as an array of strings.
Should only be used with commands that return replies on the command channel - do not use for LIST, NLST, MLSD etc.