| | |
| | | |
| | | FTPFile[] files = ftp.listFiles(); |
| | | if (files.length==0){ |
| | | ftp.logout(); |
| | | return false; |
| | | } |
| | | else { |
| | |
| | | } |
| | | } |
| | | //关闭流 |
| | | ftp.completePendingCommand(); |
| | | ftp.logout(); |
| | | // ftp.completePendingCommand(); |
| | | // ftp.logout(); |
| | | } |
| | | } catch (Exception e) { |
| | | System.out.println("ftp连接失败"); |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | ftp.logout(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if (ftp.isConnected()) { |
| | | try { |
| | | ftp.disconnect(); |
| | |
| | | FTPFile[] files = ftp.listFiles(); |
| | | //文件个数大于10个时开始处理 |
| | | if (files.length==0){ |
| | | ftp.logout(); |
| | | |
| | | return false; |
| | | } |
| | | else { |
| | |
| | | } |
| | | } |
| | | //关闭流 |
| | | ftp.completePendingCommand(); |
| | | ftp.logout(); |
| | | // ftp.completePendingCommand(); |
| | | // ftp.logout(); |
| | | } |
| | | } catch (Exception e) { |
| | | System.out.println("ftp连接失败"); |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | ftp.logout(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if (ftp.isConnected()) { |
| | | try { |
| | | ftp.disconnect(); |