|
@@ -82,7 +82,7 @@ public class ViewController extends Controller {
|
|
|
|
|
|
public void downloadFtpFile() {
|
|
|
String remoteFileName = this.getPara("a");
|
|
|
-// String fileName = this.getPara("b");
|
|
|
+ String fileName = "";
|
|
|
FTPClient ftpClient = new FTPClient();
|
|
|
int reply;
|
|
|
try {
|
|
@@ -97,8 +97,9 @@ public class ViewController extends Controller {
|
|
|
ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
|
|
|
ftpClient.enterLocalPassiveMode();
|
|
|
|
|
|
- FTPFile allFile[] = ftpClient.listFiles("");
|
|
|
+ FTPFile allFile[] = ftpClient.listFiles(remoteFileName);
|
|
|
for (int i = 0; i < allFile.length; i++) {
|
|
|
+ fileName=fileName+ allFile[i].getName();
|
|
|
File localFile = new File("/home/zskk/FTP_FILE" + File.separatorChar + allFile[i].getName());
|
|
|
OutputStream os = new FileOutputStream(localFile);
|
|
|
//ftp中文名需要iso-8859-1字符
|
|
@@ -114,7 +115,7 @@ public class ViewController extends Controller {
|
|
|
|
|
|
ftpClient.logout();
|
|
|
ftpClient.disconnect();
|
|
|
- renderText("succ");
|
|
|
+ renderText(fileName);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|