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

Discussion in 'Java' started by elektrophyte, Sep 30, 2005.

  1. elektrophyte

    elektrophyte Guest

    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
    elektrophyte, Sep 30, 2005
    #1
    1. Advertising

  2. elektrophyte

    elektrophyte Guest

    I figured it out.

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

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

    Thanks,

    E
    elektrophyte, Sep 30, 2005
    #2
    1. Advertising

  3. elektrophyte

    Alan Krueger Guest

    elektrophyte wrote:
    > 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"/>
    Alan Krueger, Oct 2, 2005
    #3
  4. elektrophyte

    Roedy Green Guest

    On Sat, 01 Oct 2005 19:29:04 -0500, Alan Krueger
    <> wrote or quoted :

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


    That is not kosher XML is it?
    --
    Canadian Mind Products, Roedy Green.
    http://mindprod.com Again taking new Java programming contracts.
    Roedy Green, Oct 2, 2005
    #4
  5. On Sun, 02 Oct 2005 02:12:49 +0000, Roedy Green wrote:

    > On Sat, 01 Oct 2005 19:29:04 -0500, Alan Krueger
    > <> wrote or quoted :
    >
    >><exclude name="**/DIR_NAME"/>

    >
    > 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
    Owen Jacobson, Oct 2, 2005
    #5
  6. elektrophyte

    Roedy Green Guest

    On Sun, 02 Oct 2005 03:39:39 GMT, Owen Jacobson
    <> wrote or quoted :

    >
    >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 />
    --
    Canadian Mind Products, Roedy Green.
    http://mindprod.com Again taking new Java programming contracts.
    Roedy Green, Oct 2, 2005
    #6
  7. elektrophyte

    Alan Krueger Guest

    Roedy Green wrote:
    > On Sun, 02 Oct 2005 03:39:39 GMT, Owen Jacobson
    > <> wrote or quoted :
    >
    >>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 />


    As I understand it, that's some voodoo to get "older browsers" to take
    XHTML, not anything to do with XML.
    Alan Krueger, Oct 2, 2005
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chuck Ritzke

    Exclude Files from Copy Project?

    Chuck Ritzke, Apr 22, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    375
    Curt_C [MVP]
    Apr 22, 2004
  2. Replies:
    6
    Views:
    30,240
    Diplomat
    Jan 12, 2011
  3. Alex
    Replies:
    2
    Views:
    1,202
  4. Replies:
    1
    Views:
    2,699
  5. blazingwolf7

    Exclude Folders From Being Copy(Ant)

    blazingwolf7, Dec 22, 2008, in forum: Java
    Replies:
    0
    Views:
    1,944
    blazingwolf7
    Dec 22, 2008
Loading...

Share This Page