title: How expensive is File.exists in Java
body: <p>I am wondering how <code>File.exists()</code> works. I'm not very aware of how filesystems work, so I should maybe start reading there first.</p>
  <p>But for a quick pre information:</p>
  <p>Is a call to <code>File.exists()</code> a single action for the filesystem, if that path and filename are registered in some journal? Or does the OS get the content of the directory and then scan through it for matches?</p>
  <p>I presume this will be filesystem dependent, but maybe all filesystems use the quick approach?</p>
  <p>I'm not talking about network and tape systems. Lets keep it to ntfs, extX, zfs, jfs :-)</p>