title: Create a directory structure from a path in gradle/groovy
body: <p>I am implementing a diff package generation task in my project's gradle build from the git command line output. Currently I have a method which will give me a list of changed files from <code>git diff --name-only</code>. What I would like to do is create a directory structure in a new directory which matches the paths of each file. For example: inputting the string <code>repo/dir/file.java</code> would create in an output directory if not already created and inside it the directories <code>head/repo/dir</code> with the current <code>file.java</code> and <code>prev/repo/dir</code> with the previous <code>file.java</code>.</p>
  
  <p>My current plan is to split the string <code>repo/dir/file.java</code> on the forward slash, and create directories until the last element of the split result, then write the file there. but nothing I have been able to come up with in gradle is nice or clean. I am wondering if there is a nicer way to create directories from a string like that.</p>