title: How to convert FTPFile list to File List in Java?
body: <p>I have a list of FTP files and I can only convert the first <code>FTPFile</code> to <code>File</code>. I am using <code>org.apache.commons.net.ftp</code> library.<br>
  My code is works fine for the first time:   </p>
  
  <pre><code>for (FTPFile file : files) {
    if(ftpClient.sendNoOp()){
     if(file.getName()!=null || !file.getName().equals("")) {
             InputStream iStream=ftpClient.retrieveFileStream(file.getName());
             File file2 = File.createTempFile("xml", null);
             FileUtils.copyInputStreamToFile(iStream, file2);
             iStream.close();
                  }
    }
  }
  </code></pre>
  
  <p>From this code the loop traverse only time and the <code>FTPFile</code> is converted to <code>File</code> and after that it will get exception which is created by <em><code>null</code></em> value generated in <code>ftpClient.retrieveFileStream(file.getName())</code>.<br>
  Please help.</p>