title: I am getting 500 as reply code when I try to delete a file from remote server using java FTPClient
body: <p>When I try to delete a file using ftpclient I am getting reply code as 500. Can someone help me with the issue. As you can see in the commented section of the code I tried to move the file to other folder and I got the reply code as 500 as well. </p>
  
  <pre><code>public boolean sendFile(HttpResponse httpresponse, String accessionNumber)
              throws Exception {
      FTPClient ftpClient = null;
      boolean fileUploadStatus = false;
      InputStream inputStream = null;
      try {
          FTPSClient ftpClient = new FTPSClient(true);
          String fileName = "SampletesterFileNine.pdf";
          String remotePath = "/";
          String tempFile = remotePath + fileName;
          try {
              ftpClient.connect(server, this.port);
          } catch (Exception e) {
              e.printstackTrace();
          }
          int reply = ftpClient.getReplyCode();
          logger.info("Reply code connect :" + reply);
          if (FTPReply.isPositiveCompletion(reply)) {
              boolean login = ftpClient.login(userName, password);
              if (login) {
                  if (ftps) {
                      ((FTPSClient) ftpClient).execPROT("P");
                  }
                  logger.info("Logged in to ftp server with host " + server);
              } else {
                  logger.info("login failed");
              }
          } else {
              logger.info("login failed with exception");
          }
          ftpClient.enterLocalPassiveMode();
          ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
          logger.info("Checking whether file exists or not!!");
          inputStream = ftpClient.retrieveFileStream(tempFile);
          if(inputStream != null) {
              logger.info("File already exists");
              isFileExist = true;
              String toPath = "/failed/SampletesterFileNine.pdf";
              /*boolean renamed = ftpClient.rename(tempFile, toPath);
              logger.info("replycode is : " + ftpClient.getReplyCode());
              if(renamed) {
                  logger.info("file moved to failed folder successfully");
              } else {
                  logger.info("failed while moving file to failed folder");
              }  */
              boolean renamed = ftpClient.deleteFile(tempFile);
              logger.info("replycode is : " + ftpClient.getReplyCode());
              if(renamed) {
                  logger.info("file moved to failed folder successfully");
              } else {
                  logger.info("failed while moving file to failed folder");
              } 
              if (ftpClient.isConnected()) {
                  ftpClient.logout();
                  ftpClient.disconnect();
              }   
          }           
      } catch(Exception e) {
          throw e;
      } finally {
          try {
              if(inputStream != null) {
                  inputStream.close(); 
              }
          } catch (Exception e) {
              e.printstackTrace();
          } 
          try {
              if (ftpClient.isConnected()) {
                  ftpClient.logout();
                  ftpClient.disconnect();
              }
          } catch (Exception e) {
              e.printstackTrace();
          }
      }
      return fileUploadStatus;
  }
  </code></pre>