You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Jacob Kjome <ho...@visi.com> on 2004/01/28 00:31:55 UTC

delete jars in a dir not present in a fileset?

I'd like to delete files in a directory that are not already present in a given
fileset where the files in the fileset aren't all in the same directory.  They
all share the same base directory, but files may each be a few directories
inside.  Right now I use a <mapper type="flatten"/> to copy this fileset of jars
to a single directory.  I'd like to do something equivalent to below to keep
everything in sync with my fileset...

from:
http://marc.theaimsgroup.com/?l=ant-user&m=106452459605357&w=2

        <copy todir="${destination}">
          <fileset dir="${copyFrom}"/>
        </copy>
        <delete>
          <fileset dir="${destination}">
            <not>
              <present targetdir="${copyFrom}"/>
            </not>
          </fileset>
        </delete>

However, in my case, the ${copyFrom} isn't a directory, but a fileset (as
mentioned previously).  So, I'd like to do this...

        <copy todir="${destination}">
          <fileset refid="repository.dependencies.webapp.fileset"/>
          <mapper type="flatten"/>
        </copy>
        <delete>
          <fileset dir="${destination}">
            <not>
              <present>
                  <fileset refid="repository.dependencies.webapp.fileset"/>
                  <mapper type="flatten"/>
              </present>
            </not>
          </fileset>
        </delete>

I realize that the above won't work in Ant since <present> requires a
"targetdir" attribute and doesn't take nested fileset or mapper elements.  I'm
just wondering if there is any other way to do this that Ant-1.6.0 currently
supports?

Jake

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org