Deleting svn checkout with NAnt

nantsvn

I am attempting to delete a folder that is a svn checkout of my project so that I can do a fresh checkout. The problem is whenever I try to delete this folder using a nant delete task I keep getting the following error:

[delete] Deleting directory 'C:\projects\my_project\Trunk'.

BUILD FAILED

c:\Projects\my_project\default.build(63,4):
Cannot delete directory 'C:\projects\my_project\Trunk\SomeFolder\AnotherFolder'.
    The directory is not empty.

Is there a trick to delete a working copy with nant here? I tried doing a delete targeting only the .svn directories, but nant wouldn't delete all of them for some reason. Here is the task I was using for that, but it didn't work:

    <delete>
        <fileset basedir="myproject\trunk">
            <include name="\**\.svn" />
        </fileset>
    </delete>

Any ideas would be greatly appreciated!

Best Answer

@jitter, you were very close

first there is no dirset, I got an error when attempting to use this. here is what actually worked

<delete>
  <fileset basedir="myproject\trunk" defaultexcludes="false">
    <include name="**/.svn" />
    <include name="**/.svn/**/*" />
  </fileset>
</delete>

fileset will include directories if you have the correct selections. I think the key was using defaultexcludes="false" and using

**/.svn/**/*

which properly selects subfolder of the .svn folders.

Thanks!