title: Gradle task to delete contents in a directory but exclude jar file
body: <p>I still trying to learn Gradle Task authoring. </p>
  
  <p>I found the following solution to help with deleting the contents of a directory while leaving the directory untouched.  </p>
  
  <p>However can I please have help modifying it to exclude specific files such as the .jar file?</p>
  
  <p><a href="https://stackoverflow.com/questions/19299455/how-to-delete-an-empty-directory-or-the-directory-with-all-contents-recursively">How to delete an empty directory (or the directory with all contents recursively) in gradle?</a></p>
  
  <p>The solution was given by Heri</p>
  
  <pre><code>task deleteGraphicsAssets(type: Delete) {
      def dirName = "src" 
          file( dirName ).list().each{
          f -&gt; delete "${dirName}/${f}"
      }
  }
  </code></pre>