|
@@ -111,31 +111,31 @@ public class ViewController extends Controller {
|
|
|
ftpClient.connect(PropKit.get("ftp_host"), PropKit.getInt("ftp_port"));
|
|
|
ftpClient.login(PropKit.get("ftp_user"), PropKit.get("ftp_password"));
|
|
|
reply = ftpClient.getReplyCode();
|
|
|
-// if (!FTPReply.isPositiveCompletion(reply)) {
|
|
|
-// ftpClient.disconnect();
|
|
|
-// this.renderText("disconnect");
|
|
|
-// }
|
|
|
-// ftpClient.setControlEncoding("UTF-8");
|
|
|
-// ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
|
|
|
-// ftpClient.enterLocalPassiveMode();
|
|
|
-//
|
|
|
-// File localFile = new File("/home/tmszyy/FTP_FILE" + File.separatorChar + "test.img");
|
|
|
-// OutputStream os = new FileOutputStream(localFile);
|
|
|
-// //ftp中文名需要iso-8859-1字符
|
|
|
-// boolean flag2 = ftpClient.retrieveFile(new String("datacenterf/20241118/00434012.img".getBytes("GBK"), "iso-8859-1"), os);
|
|
|
-// if (!flag2) {
|
|
|
-// System.out.println("没有找到" + "datacenterf/20241118/00434012.img" + "---该文件");
|
|
|
-// localFile.delete();
|
|
|
-// this.renderText("nofind");
|
|
|
-//
|
|
|
-// } else {
|
|
|
-// System.out.println("=================== save success");
|
|
|
-// this.renderText("succ");
|
|
|
-//
|
|
|
-// }
|
|
|
-// os.close();
|
|
|
-// ftpClient.logout();
|
|
|
-// ftpClient.disconnect();
|
|
|
+ if (!FTPReply.isPositiveCompletion(reply)) {
|
|
|
+ ftpClient.disconnect();
|
|
|
+ this.renderText("disconnect");
|
|
|
+ }
|
|
|
+ ftpClient.setControlEncoding("UTF-8");
|
|
|
+ ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
|
|
|
+ ftpClient.enterLocalPassiveMode();
|
|
|
+
|
|
|
+ File localFile = new File("/home/zskk/FTP_FILE" + File.separatorChar + "test.img");
|
|
|
+ OutputStream os = new FileOutputStream(localFile);
|
|
|
+ //ftp中文名需要iso-8859-1字符
|
|
|
+ boolean flag2 = ftpClient.retrieveFile(new String("datacentere/20241123/04E73F37.img".getBytes("GBK"), "iso-8859-1"), os);
|
|
|
+ if (!flag2) {
|
|
|
+ System.out.println("没有找到" + "datacenterf/20241118/00434012.img" + "---该文件");
|
|
|
+ localFile.delete();
|
|
|
+ this.renderText("nofind");
|
|
|
+
|
|
|
+ } else {
|
|
|
+ System.out.println("=================== save success");
|
|
|
+ this.renderText("succ");
|
|
|
+
|
|
|
+ }
|
|
|
+ os.close();
|
|
|
+ ftpClient.logout();
|
|
|
+ ftpClient.disconnect();
|
|
|
this.renderText(String.valueOf(reply));
|
|
|
|
|
|
} catch (Exception e) {
|