| | |
| | | //ftp.changeWorkingDirectory(new String(dir.getBytes("GBK"), FTP.DEFAULT_CONTROL_ENCODING)); |
| | | |
| | | // 检验文件是否存在 |
| | | ftp.changeWorkingDirectory(ftpPath); |
| | | FTPFile[] files = ftp.listFiles(); |
| | | if (files.length==0){ |
| | | if (files.length == 0) { |
| | | return false; |
| | | } |
| | | else { |
| | | for (FTPFile file : files){ |
| | | } 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){ |
| | | if (null == is) { |
| | | return false; |
| | | }else { |
| | | } else { |
| | | String substring1 = fileName.substring(0, 1); |
| | | if (substring1.equals("w")) { |
| | | //把文件下载到本地 |
| | |
| | | is.close(); |
| | | ftp.completePendingCommand(); |
| | | } |
| | | else { |
| | | //把文件下载到本地 |
| | | FtpUtil.downloadFtpFile(ftpHost_dev, ftpUserName, ftpPassword, ftpPort, ftpPath, MinioPath, fileName); |
| | | //MysqlCenlint.deletess(fileName); |
| | | FtpUtil.deleteFile(ftpHost_dev, ftpPort, ftpUserName, ftpPassword, "anbao/", fileName); |
| | | is.close(); |
| | | ftp.completePendingCommand(); |
| | | } |
| | | } |
| | | } |
| | | return true; |