title: In nant, how to delete contents of a directory, but not the directory itself?
body: <p>Suppose I were scripting a deployment using nant on a Windows server to a file share: <code>\\server\share</code>.  I want a nant script to delete all files from the share then copy in new files.</p>
  
  <p>I have this code to delete the files, but I'm getting an error that it can't delete "\server\share".  But I didn't want to delete the share, just the contents in it.</p>
  
  <pre><code>&lt;delete&gt;
     &lt;fileset basedir="\\server\share"&gt;
        &lt;include name="**/**" /&gt;
     &lt;/fileset&gt;
  &lt;/delete&gt;
  </code></pre>
  
  <p>Output:</p>
  
  <pre>
  BUILD FAILED
  
  D:\code\xxx\xxx.deploy(177,8):
  Cannot delete directory '\\server\share'.
      Access to the path '\\server\share' is denied.
  </pre>
  
  <p>If I modified it to instead delete contents of a directory in the share, say <code>\\server\share\somedir</code>, it'll delete "somedir" without error.  But still, I didn't want to delete the dir, just the contents.  Is there a way?</p>