title: Make file empty/clear on ftp server after download in Java
body: <p>I wrote the following method with Java which download a file for me, 
  from the Server to my local computer.</p>
  
  <pre><code>public void downloadcsv() {
  
      String server = "servername.host";
      int port = 21;
      String user = "username";
      String pass = "password";
  
      FTPClient ftpClient = new FTPClient();
      try {
  
          ftpClient.connect(server, port);
          ftpClient.login(user, pass);
          ftpClient.enterLocalPassiveMode();
          ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
  
          String remoteFile = "/serverpath/daten.csv";
          File downloadFile = new File("localpath/daten.csv");
          OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(downloadFile));
  
          boolean success = ftpClient.retrieveFile(remoteFile, outputStream);
  
          outputStream.close();
  
          if (success) {
              System.out.println("File has been downloaded successfully.");
          }
  
      } catch (IOException ex) {
  
          System.out.println("Error: " + ex.getMessage());
          ex.printStackTrace();
  
      } finally {
          try {
              if (ftpClient.isConnected()) {
                  ftpClient.logout();
                  ftpClient.disconnect();
              }
          } catch (IOException ex) {
              ex.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p>So far so good.
  Now, I want to delete the content of the file on the server.</p>
  
  <p>Just the content, because I need the file to write in it with another program.</p>
  
  <p>Is there a fast way to do that, while or after the download?</p>
  
  <p>Now, I just delete the file with another method and create a new file.</p>
  
  <p>But that seems to be inefficient.
  Thanks for help.</p>