In Ant how do you exclude a directory from copy or zip

E

elektrophyte

I understand from the Ant manual how to create a <fileset> with nested
<exclude> elements. I can get it to exclude files that have names
matching a given pattern.

I would like to exclude certain entire directories. Not just the files
within the directory (that could be done with "<exclude
name="**/DIR_NAME/*"></exclude>"). I would like to exclude even the
directory itself from the root.

I've tried name="DIR_NAME".

I've considered using a "DirSet" instead of a "fileset" but it appears
that the copy and zip tasks do not support the DirSet element.

Thanks in advance for any help with this.

E
 
E

elektrophyte

I figured it out.

<exclude name="**/DIR_NAME/**" />

I'd still appreciate any comments on a better/more efficient approach.

Thanks,

E
 
A

Alan Krueger

elektrophyte said:
I figured it out.

<exclude name="**/DIR_NAME/**" />

I'd still appreciate any comments on a better/more efficient approach.

What happens if you do this?

<exclude name="**/DIR_NAME"/>
 
O

Owen Jacobson

That is not kosher XML is it?

Looks fine to me... tag delimiter, tag identifier, attribute identifier,
attribute delimiter ('='), quoted string ("**/DIR_NAME"), terminating
slash for an empty tag, tag delimiter.

It just means an exclude element with name="**/DIR_NAME" and no content.

-Owen
 
R

Roedy Green

Looks fine to me... tag delimiter, tag identifier, attribute identifier,
attribute delimiter ('='), quoted string ("**/DIR_NAME"), terminating
slash for an empty tag, tag delimiter.

The reason I say that is when I did XHTML validation, it insisted on a
space before />
 
A

Alan Krueger

Roedy said:
The reason I say that is when I did XHTML validation, it insisted on a
space before />

As I understand it, that's some voodoo to get "older browsers" to take
XHTML, not anything to do with XML.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top