ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Jan.Mate...@rzf.fin-nrw.de>
Subject AW: Get the modification time of a file into a property.
Date Wed, 29 Mar 2006 05:36:00 GMT
>> 1. If lastrun.txt exists, get the modification time into a property.
>> 2. Extract the documents based on the property if it exists. 
>If property
>> does not exist, just get everything.
>> 3. Touch the file lastrun.txt
>>
>> I don't know how to accomplish step 1. I could write a 
>wrapper script to
>> get the value and pass it into Ant, but I would prefer to do 
>this within
>> Ant.


<tstamp> and writing the "modification time" _into_ the file.
Use <loadproperty> to load that into a property.

So something like
  <!-- load the former saved time -->
  <loadproperty property="lastrun" file="lastrun.txt"/>
  <!-- return to a 'very old' value if nothing was set. Props are
immutable! -->
  <property name="lastrun" value="19800101000000"/> 
  <!-- use the property -->
  <doTheWork since="${lastrun}"/>
  <tstamp>
    <pattern property="now" format="yyyymmddHHMMss"/>
  </tstamp>
  <echo file="lastrun.txt">${now}</echo>

Maybe not the correct syntax (wrote by head), but you should get the
meaning ;-)


Jan

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


Mime
View raw message