ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ciramella, Edward" <ECirame...@emptoris.com>
Subject <date> selector
Date Fri, 07 Feb 2003 22:11:08 GMT
I want to write a target to delete all items that are after a particular
date.

Before I roll this out, I wanted to test my functionality in the following
manner:
-create a file
-sleep 2 min
-create a file
-sleep 2 min
-create a file
-sleep 2 min
-create a file

-take a timestamp
-delete all files older than timestamp -2 min

every time I run this it deletes all my files vs just the ones that are
currenttime-2min old.

What am I missing?

<target name="build">
     <touch file="myfile-1.txt"/>
 <sleep minutes="2"/>
     <touch file="myfile-2.txt"/>
 <sleep minutes="2"/>
     <touch file="myfile-3.txt"/>
 <sleep minutes="2"/>
     <touch file="myfile-4.txt"/>
 <tstamp>
     <format property="bld.date" pattern="MM/DD/yyyy hh:mm a" locale="en"
offset="-2 unit="minute"/>
 </tstamp>

 <echo message="${bld.date}"/>
   <delete>
     <fileset dir="." includes="**/*.txt"> 
	<date datetime="${bld.date}" when="before"/>
     </fileset>
  </delete>

</target>



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