ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@yahoo.com>
Subject RE: <replaceregexp> to wipe out everything in a file
Date Fri, 18 Jun 2004 17:45:56 GMT
Basically, using <touch> after <delete> to create
empty files necessitates knowing the name of every
file.  If you don't know these in advance you could do
something like this:

<property name="dir" location="wipe" />

<pathconvert property="files" pathsep=",">
  <path>
    <fileset id="set" dir="${dir}" 
             includes="**/*.log" />
  </path>
  <map from="${dir}" to="" />
</pathconvert>

<wipe dir="${dir}" files="${files}" />

<macrodef name="wipe">
  <attribute name="dir" />
  <attribute name="files" />
  <sequential>
    <delete>
      <fileset dir="@{dir}" includes="@{files}" />
    </delete>
    <touch>
      <filelist dir="@{dir}" files="@{files}" />
    </touch>
  </sequential>
</macrodef>

If/when we get <local> properties you could
encapsulate the whole thing in a <macrodef> and THAT
would be slick...

-Matt



		
__________________________________
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.
http://promotions.yahoo.com/new_mail

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


Mime
View raw message