title: How can I tell if a file or folder is busy, e.g. the Finder is busy copying to it?
body: <p>I have tried:</p>
  
  <ol>
  <li><p>Checking the <code>FSCatalogInfo</code> <code>nodeFlags</code> to see if <code>kFSNodeForkOpenBit</code> is set (using <code>kFSNodeForkOpenMask</code>).</p></li>
  <li><p>Checking whether the creator code is between <code>kFirstMagicBusyFiletype</code> and <code>kLastMagicBusyFiletype</code>. </p></li>
  <li><p>Checking the <code>ExtendedFileInfo</code> <code>extendedFinderFlags</code> to see if <code>kExtendedFlagObjectIsBusy</code> is set.</p></li>
  <li><p>Running <code>GetFileInfo -ab</code> from the shell.</p></li>
  </ol>
  
  <p>All of these report that the file the Finder is copying to is <em>not</em> open.</p>
  
  <p>Using <code>lsof</code> does detect that the file is open, but (a) I don't want to call <code>lsof</code> from my application, and (b) my understanding is that it relies on private API so looking at its source wouldn't help.</p>