ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Guild <jason.gu...@alaska.gov>
Subject deleting files not in whitelist
Date Tue, 17 Jul 2018 23:45:17 GMT
Hello:

I have a build file which declares a <resources> containing a list of 
expected files which are relative to some directory. I am trying to 
delete any files from that directory which /are not present/ in the 
<resourcelist>, and I can't figure out how to do that with the <delete> 
task and my understanding of the standard selectors.

Here's my resource list:

    <resources id="my-whitelist">
         <resourcelist basedir="${some.dir}">
             <url url="${target.files.url}"/>
         </resourcelist>
    </resources>

Basically my-whitelist is simply a list of filenames which are expected 
to exist relative to ${some.dir}.

In a target, I would like to somehow use the <delete> task to delete any 
files found in ${some.dir} which are /not listed in/ "my-whitelist", 
like this:

    <delete dir="${some.dir}">
         <not>
             <resources refid="my-whitelist"/>
    </not>
    </delete>

But this doesn't work. I also tried:

    <delete>
         <restrict>
             <fileset dir="${some.dir}"/>
             <rsel:not
    xmlns:rsel="antlib:org.apache.tools.ant.types.resources.selectors">
                 <resources refid="my-whitelist"/>
             </rsel:not>
         </restrict>
    </delete>

Which doesn't work either.
Any help you can provide would be appreciated.

Thanks,
Jason


Mime
View raw message