ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject AW: Generating rotating file name?
Date Thu, 02 Mar 2006 07:07:36 GMT
You could try playing with AntContribs <math> task, but I think in your case
the easiest is to implement your own task using <script>.

     nowMS  = System.getTimeMillies
     nowDay = nowMS / 1000 / 60 / 60 / 24
     number = nowDay % 4
     project.setNewProperty("nr", number)
  <echo file="file.${nr}"> hello </echo>


>-----Ursprüngliche Nachricht-----
>Von: JWM [] 
>Gesendet: Donnerstag, 2. März 2006 07:43
>An: 'Ant Users List'
>Betreff: Generating rotating file name?
>I need to generate a 4-cycle rotating file name based on the 
>day (first day = "file.1", second day = "file.2, .. fifth day 
>= "file.1" (repeating).
>Basically I need to generate a string that is "Julian date mod 
>4" to append to my base filename.  <Tstamp> with the 
>DateFormatter gives me a lot of options.  But I don't see this one.
>Is there a way to get a numeric value (i.e. Julian date from 
>tstamp) and do a 'mod' operation on it to get a new property?
>Is there a better way to get a rotating string that increments 
>each day, then repeats after a specified max?
>To unsubscribe, e-mail: For 
>additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message