Yea, it's a little tricky to get this to work. I usually have to play
with it for a while. Also, I found you had to add the full path to the
exclude even if you include a basedir. Also, it seems to work better if
you put the excludes first... try this:

<delete failonerror="false" verbose="true">
    <fileset basedir="${Globals.SourcePath}">
        <exclude name="${Globals.SourcePath}/FolderA" />
        <exclude name="${Globals.SourcePath}/FolderA/FolderB" />
        <exclude name="${Globals.SourcePath}/FolderA/FolderB/**" />
      <include name="**" />
    </fileset>
</delete>

I think what happens is, even if you exclude /FolderA/** which is
everything in FolderA, then include everything, then FolderA is part of
everything... so, in addition you have to exclude the folder. In other
words, it isn't smart enough to keep the folder when you ask it to keep
the contents of a folder.

You could also try it without the "${Globals.SourcePath} in the
excludes, but I seem to remember it not working without that. I could be
wrong. So you could try:

<delete failonerror="false" verbose="true">
    <fileset basedir="${Globals.SourcePath}">
        <exclude name="FolderA" />
        <exclude name="FolderA/FolderB" />
        <exclude name="FolderA/FolderB/**" />
      <include name="**" />
    </fileset>
</delete>

At least, this is what I remember needing to do that worked for me.

BOb

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jason
Fleming
Sent: Friday, September 29, 2006 10:05 AM
To: nant-users@lists.sourceforge.net
Subject: [NAnt-users] Problem with include/exclude...


Hi all,

I?m currently having a bit of trouble using include and exclude in
delete
task and was hoping someone might be able to help?
I have the following:

<delete failonerror="false" verbose="true">
    <fileset basedir="${Globals.SourcePath}\">
        <include name="FolderA\**" />
        <exclude name="FolderA\FolderB" />
        <exclude name="FolderA\FolderB\**\*.*" />
    </fileset>
</delete>

?and I assumed this would delete the entire contents of
${Globals.SourcePath}\FolderA and all sub-folders apart from the files
in
FolderB and it?s sub-folders, unfortunately what I?m seeing is that
everything is being deleted?which in turn causes my build to fail as the
files here are required. Can anyone suggest how to get the behaviour I
need?
I?ve tried searching the list and found similar problems?and the snippet
above actually comes from a working delete that someone else posted
here?

Thanks for any help,
Jay
-- 
View this message in context:
http://www.nabble.com/Problem-with-include-exclude...-tf2357071.html#a65
65589
Sent from the NAnt - Users mailing list archive at Nabble.com.


------------------------------------------------------------------------
-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDE
V
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to