title: How to check if a directory containing a file exist?
body: <p>I am using <code>groovy</code> to create a file like <code>"../A/B/file.txt"</code>. To do this, I have created a <code>service</code> and pass the <code>file path</code> to be created as an <code>argument</code>. This service is then used by a <code>Job</code>. The <code>Job</code> will do the logic in creating the file in the specified directory. I have manually created the "A" directory.</p>
  
  <p>How will I create the "B" directory and the file.txt inside the "A" directory through codes to create it automatically?</p>
  
  <p>I need also to check if directories "B" and "A" exists before creating the file.</p>