ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dalg...@ix.netcom.com (Mike Castle)
Subject Re: xargs task?
Date Mon, 25 Aug 2003 17:05:53 GMT
In article <20030823054929.42390.qmail@web40911.mail.yahoo.com>,
Jason Varsoke  <user@ant.apache.org> wrote:
>Specifically I'd like to pass <delete> a filename that contains a list
>of \n seperated files to be deleted.  Same as:
>$ cat files.txt | xargs rm

<foreach/> task from ant-contrib.

Something like:

<loadfile property="list.of.files.to.delete" srcFile="delete.list">
   <filterchain>
      <striplinebreaks/>
   </filterchain>
</loadfile>
<delete verbose="true">
   <fileset dir="." includes="${file.list}"/>
</delete>

Then, in your delete.list, add an extra space at the end of each line, so
your input file, which looks like this:
a/b 
b/c 

will end up as a property looking like:
a/b b/c

Of course, this only works on files relative to basedir.  Can't do
something like:
a/b
/tmp/foo
b/c

Such is the power and flexibility of ant.

mrc
-- 
     Mike Castle      dalgoda@ix.netcom.com      www.netcom.com/~dalgoda/
    We are all of us living in the shadow of Manhattan.  -- Watchmen
fatal ("You are in a maze of twisty compiler features, all different"); -- gcc

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


Mime
View raw message