Suppose I were scripting a deployment using nant on a Windows server to a file share: \\server\share
. I want a nant script to delete all files from the share then copy in new files.
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.
<delete>
<fileset basedir="\\server\share">
<include name="**/**" />
</fileset>
</delete>
Output:
BUILD FAILED D:\code\xxx\xxx.deploy(177,8): Cannot delete directory '\\server\share'. Access to the path '\\server\share' is denied.
If I modified it to instead delete contents of a directory in the share, say \\server\share\somedir
, it'll delete "somedir" without error. But still, I didn't want to delete the dir, just the contents. Is there a way?