title: Camel route picking up file before ftp is complete
body: <p>I have a customer who ftp's a file over to our server.  I have a route defined to select certain files from this directory and move them to a different directory to be processed.  The problem is that it takes it as soon as it sees it and doesn't wait till the ftp is complete. The result is a 0 byte file in the path described in the to uri.  I have tried each of the readLock options (masterFile,rename,changed, fileLock) but none have worked.  I am using spring DSL to define my camel routes.  Here is an example of one that is not working. camel version is 2.10.0</p>
  
  <pre><code>    &lt;route&gt;
          &lt;from uri="file:pathName?initialDelay=10s&amp;amp;move=ARCHIVE&amp;amp;sortBy=ignoreCase:file:name&amp;amp;readLock=fileLock&amp;amp;readLockCheckInterval=5000&amp;amp;readLockTimeout=10m&amp;amp;filter=#FileFilter" /&gt;
          &lt;to uri="file:pathName/newDirectory/" /&gt;
      &lt;/route&gt;
  </code></pre>
  
  <p>Any help would be appreciated. Thanks!</p>
  
  <p>Just to note...At one point this route was running on a different server and I had to ftp the file to another server that processed it.  When I was using the ftp component in camel, that route worked fine.  That is it did wait till the file was received before doing the ftp.  I had the same option on my route defined. Thats why I am thinking there should be a way to do it since the ftp component uses the file component options in camel.</p>
  
  <hr>
  
  <p>I am taking @PeteH's suggestion #2 and did the following.  I am still hoping there is another way, but this will work.</p>
  
  <p>I added the following method that returns me a Date that is current.minus(x seconds) </p>
  
  <pre><code>public static Date getDateMinusSeconds(Integer seconds) {
  Calendar cal = Calendar.getInstance();
  cal.add(Calendar.SECOND, seconds);
  return  cal.getTime();
  }
  </code></pre>
  
  <p>Then within my filter I check if the initial filtering is true. If it is I compare the Last modified date to the getDateMinusSeconds().  I return a false for the filter if the comparison is true.</p>
  
  <pre><code>    if(filter){
          if(new Date(pathname.getLastModified()).after(DateUtil.getDateMinusSeconds(-30))){
              return false;
          }
      } 
  </code></pre>