title: Deleting directory in finally block?
body: <p>I'm creating a temporary directory to do some housekeeping tasks and want to delete it as soon as all these tasks done. The thing is these jobs can throw exceptions, but I still don't want to delete all these tons of temporary files manually. Here is how it looks like:</p>
  
  <pre><code>try{
     Path p = //tmp dir
     doJob1(p);
     doJob2(p);
  } finally{
     p.toFile().delete();
  }
  </code></pre>
  
  <p>The thing is I have never seen something like that. Releasing locks in <code>finally</code> block -- is common. But what about deleting files? Are there some drawbacks?</p>