| | |
| | | //private static String fileName = "nsql.json"; |
| | | |
| | | |
| | | @Scheduled(cron = "*/30 * * * * ?") |
| | | //@Scheduled(cron = "*/30 * * * * ?") |
| | | public static boolean isFTPFileExist() { |
| | | |
| | | FTPClient ftp = new FTPClient(); |
| | |
| | | // 设置编码格式 |
| | | |
| | | ftp.setControlEncoding("GBK"); |
| | | |
| | | // 提取绝对地址的目录以及文件名 |
| | | |
| | | //ftpPath = ftpPath.replace("ftp://" + ftpHost + ":" + ftpPort + "/", ""); |
| | |
| | | return false; |
| | | } else { |
| | | for (FTPFile file : files) { |
| | | System.out.println("文件:"+file); |
| | | String fileName = file.getName(); |
| | | InputStream is = ftp.retrieveFileStream(new String(fileName.getBytes("GBK"), FTP.DEFAULT_CONTROL_ENCODING)); |
| | | if (null == is) { |
| | |
| | | |
| | | |
| | | } catch (Exception e) { |
| | | |
| | | e.printStackTrace(); |
| | | |
| | | } finally { |