1

I'm trying to exclude all dirs which contain the string "export". Only one directory called "exportspecial" should be included.

This way "exportspecial" is still not included:

    <fileset dir="${dir.root}/plugins" id="something">
        <include name="abc/**" />
        <exclude name="abc/*export**" />            
        <include name="abc/exportspecial/**" />         
    </fileset>
Mike
  • 5,416
  • 4
  • 40
  • 73

1 Answers1

0

You can use selectors

    <fileset dir=".">
        <include name="abc/**"/>
        <or>
            <filename name="**/exportspecial/**"/>
            <not>
                <filename name="**/*export*/**"/>
            </not>
        </or>
    </fileset>

Example build file:

<project name="selector-test" default="includeTest" basedir=".">
    <target name="includeTest" depends="prepare">
      <path id="export.path">
        <fileset dir=".">
          <include name="abc/**"/>
          <or>
            <filename name="**/exportspecial/**"/>
            <not>
              <filename name="**/*export*/**"/>
            </not>
          </or>
        </fileset>
      </path>
      <pathconvert pathsep="${line.separator}"
                   property="echo.include.path"
                   refid="export.path"/>
      <echo>${echo.include.path}</echo>
  </target>

  <target name="prepare">
    <touch file="abc/test/inc" mkdirs="true"/>
    <touch file="abc/exportspecial/inc" mkdirs="true"/>
    <touch file="abc/export/exc" mkdirs="true"/>
    <touch file="abc/inc"/>
  </target>

</project>
Siad Ardroumli
  • 596
  • 2
  • 9