It's not intuitive, but we use something like this and it works ok.  This erases all 
files except the config directory and except for *.config in the top level directory 
or in config\.

                <delete failonerror="false">
                        <fileset>
                                <includes name="${build.dir}\*"/>
                                <includes name="${build.dir}\*\**"/>
                                <excludes name="${build.dir}\**\*.config"/>
                                <excludes name="${build.dir}\config"/>
                        </fileset>
                </delete>

Oddly enough, even if there was a file named ${build.dir}\web\web.config, it would be 
deleted even though **\*.config was excluded.  It seems that this is because the 
${build.dir}\web\ directory itself was included and that seems to take precedent.  I 
wish this behaved differently.  

Also, to exclude a directory itself (not it's contents), you have to _not_ put \** 
after the directory name (compare my ${build.dir}\config to your user\**.  However, 
just excluding "user" will only keep the empty directory around.  If you want to 
preserve the entire "user" subtree, you need to exclude both the directory and it's 
contents:

<delete failonerror="false" verbose="true">
    <fileset basedir="${dir.prod}">
        <includes name="**" />
        <excludes name="user" />
        <excludes name="user\**" />
    </fileset>
</delete>

Like I said, less than obvious, and less than friendly, but it works if you get the 
hang of it.


-----Original Message-----
From: Lawrence, Richard [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 25, 2003 9:56 AM
To: [EMAIL PROTECTED]
Subject: [Nant-users] delete task - problem with exclude

When publishing my ASP.NET project, I want to leave two directories and their contents 
in place, while deleting everything else. As I understand filesets, the following 
should work. But user and Uploads get deleted. What am I missing?

<delete failonerror="false" verbose="true">
    <fileset basedir="${dir.prod}">
        <includes name="**" />
        <excludes name="user\**" />
        <excludes name="Uploads\**" />
    </fileset>
</delete>

Here's an excerpt of nant's output:

   [delete] Deleting directory E:\Intranet Sites\PDSIIntranet_Staging2\Uploads.
   [delete] Deleting file E:\Intranet 
Sites\PDSIIntranet_Staging2\user\fdf631873938627446875.fdf.

I'm using version 0.8.2.

Thanks,

Richard
 



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Nant-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-users


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Nant-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to