title: How to get SSIS to wait for a file to exist and/or become available
body: <p>Scenario:
  Package#1 creates a flat file that contains multiple messages (one per line) that is dropped in an external system's "INPUT" folder. The file is picked up by the external system and processed and the responses are written in the same format to a file in the "OUTPUT" folder. The file starts to be written  while the external system is still processing messages, so it is written as foo.rsppro. When processing is complete and all response messages are written it is renamed foo.rsp.</p>
  
  <p>I need to pick up that file once it is complete (i.e. after the rename) and process using Package#2, which will start immediatly following Package#1. When Package#2 starts, the external system could be in three states:</p>
  
  <ol>
  <li>Processing the first message not yet complete and no response file written yet, in which case I need to wait for foo.rsppro to be written, then renamed to foo.rsp</li>
  <li>Processing in progress and foo.rsppro written, in which case I need
  to wait for foo.rsppro to be renamed to foo.rsp</li>
  <li>Processing completed, foo.rsppro has been written and been renamed to foo.rsp, in which case I just need to process foo.rsp.</li>
  </ol>
  
  <p>I have tried:</p>
  
  <ol>
  <li>using a <a href="http://microsoft-ssis.blogspot.com/2012/01/custom-ssis-component-file-in-use-task.html" rel="nofollow">file in use task</a> but that errors if the expected file isn't present when the task begins (i.e. errors for scenario 1 and 2)</li>
  <li>using a <a href="http://www.konesans.com/products/file-watcher-task.aspx" rel="nofollow">file watcher task</a> but that appears to ignore file renames by design, so will never handle scenario 1 or 2</li>
  </ol>
  
  <p>Aside from building a <a href="http://microsoft-ssis.blogspot.com/2011/05/wait-until-file-is-unlocked.html" rel="nofollow">script task</a>, is there a custom task that will handle all three scenarios?</p>
  
  <p>Edit: SSIS 2008 R2</p>