ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject Re: reverse glob mapper pattern?
Date Tue, 24 Sep 2002 01:20:22 GMT
Hi Bruce,

You should probably go back and check out this whole thread.  I had already 
tried what you suggest below.  All that will do is select all files to 
delete.  See Diane's responses to see why that can't work.  Also see the 
solution I just posted.  It really is the only way to do this, currently.

Jake

At 05:52 PM 9/23/2002 -0700, you wrote:
>At 05:05 AM 9/21/2002 -0500, Jacob Kjome wrote:
>
>>Now what I'd like to do is set up a way to delete the files generated by 
>>this copy.  So, I need to find all files that have a corresponding 
>>"sample.*" file and delete those.
>>
>>If I just use the following, it deletes the sample.* file, not the * file 
>>which is the opposite of what I want...
>>
>>         <delete>
>>             <fileset
>>                 dir="${src.dir}" >
>>                 <present present="both" targetdir="${src.dir}">
>>                     <mapper type="glob" from="sample.*" to="*" />
>>                 </present>
>>             </fileset>
>>         </delete>
>>
>>So, my question is, how do I set up a pattern where the fileset will get 
>>a list of the "*" files rather than the sample.* files to delete?
>
>Reverse the mapper "from" and "to" attributes.
>
>What you are asking  for in your fileset is all of the files in the 
>${src.dir} that are named "sample.*" and that have a matching "*" file. 
>What you want to be asking for is all the files named "*" for which there 
>is a matching "sample.*". Change the mapper to:
>
>     <mapper type="glob" from="*" to="sample.* />
>
>and you will have better luck.
>
>I'd also recommend an exclude of "sample.*" thrown in there so you aren't 
>checking for the existence of "sample.sample.my.properties" or similar. 
>Not necessary, but cleaner in understanding what the task is doing and a 
>trifle more efficient. It would also have been clearer for debugging, as 
>then your task wouldn't have done anything at all.
>
>
>
>--
>To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message