title: Receive an empty log file from FTP client while connecting to Azure - because log is "in use"
body: <p><strong>Problem is :</strong> </p>
  
  <pre><code>FTPClient client = new FTPClient();
  </code></pre>
  
  <p>ofcourse i have all the connection details here and than : </p>
  
  <pre><code>InputStream inputStream = client.retrieveFileStream( file.getName());
  System.out.println(client.getReplyString());
  </code></pre>
  
  <p><strong>The output:</strong> </p>
  
  <pre><code>550 The process cannot access the file because it is being used by 
  another process. 
  </code></pre>
  
  <p>How can I take this log-file anyway?</p>
  
  <p><strong>Here is the full code :</strong> </p>
  
  <pre><code>public static void retrieveLogFilesFTP() {
          try {
  
              FTPClient client = new FTPClient();
  
          for (int i = 0; i &lt; components.length; i++) {
  
              client.connect(ENV_PROD);
              client.login([loginUserName], [loginPassword]);
              client.enterLocalPassiveMode();
              client.setFileType(FTP.BINARY_FILE_TYPE);
              client.changeWorkingDirectory("/site/wwwroot");
  
  
                  FTPFile[] ftpFiles = client.listFiles();
  
                  if (ftpFiles != null &amp;&amp; ftpFiles.length &gt; 0) {
  
  
                      for (FTPFile file : ftpFiles) {
                          if (file.getName().startsWith("httpplatform")) {
  
  
                              File currentDirectory = new File(PATH + components[i]);
                              if (!currentDirectory.exists()) {
                                  currentDirectory.mkdir();
                              }
  
                              OutputStream output = new FileOutputStream(currentDirectory + "/" + file.getName(), false);
                              client.retrieveFile(file.getName(), output);
  
  
                              System.out.println(client.getReplyString());
  
                              output.close()
  
  
                          }
  
                      }
  
                  }
  
  
              client.logout();
              client.disconnect();
              changeLogFilesNames(new File(PATH + "/" + components[i] + "/"), components[i]);
  
  
          }
  
  
      } catch (Exception ex) {
          ex.printStackTrace();
      }
  
  
  }
  </code></pre>