title: Mule - delete file after doing some processing
body: <p>I need some help with deleting the file in Mule application. Here is my use case:</p>
  
  <ol>
  <li><p>I get a file using File Inbound Endpoint, get the data and upload the data to the database after doing some validations on the data.</p></li>
  <li><p>I would like to delete the file after uploading to database is successful. I tried using java.io.File.delete(as suggested in the this stackoverflow post) but it's not working. </p></li>
  </ol>
  
  <p><a href="https://stackoverflow.com/questions/35668218/mule-delete-files-with-files-connector">Mule - Delete files with Files Connector</a></p>
  
  <p>I am using Mule 3.3.2 and running the server on my local machine. (I am able to delete the file when I delete using a simple Java program.) </p>
  
  <p>Could you please help?</p>
  
  <p>----UPDATE----
  This is what I have in my OnCall() method of the Java component I am using to delete the file. isDeleted returns false.</p>
  
  <pre><code>@Override
  public Object onCall(MuleEventContext eventContext) throws Exception {
  
    String fileName = (String) eventContext.getMessage().getProperty(
              "originalFilename");
  
      filePath = "C:\\REP-UNZIP\\";
      File file = new File(filePath + fileName);
  
      boolean isDeleted = false;
      isDeleted = java.nio.file.Files.deleteIfExists(file.toPath());
      if (file.isFile()) {
          isDeleted = file.delete();
      }
  </code></pre>
  
  <p>//      isDeleted = FileUtils.deleteQuietly(file);
          LOG.info("isDeleted = " + isDeleted);</p>
  
  <pre><code>    return Boolean.valueOf(isDeleted);
  }
  </code></pre>