You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Andreas Bakurov <an...@gmail.com> on 2008/07/15 10:52:05 UTC

Creating file containing current date in its filename

I am trying to figure out if it possible to generate a zip file which name
will contain a current date , for example

archive_15jul08.zip will be created at 15 July, 2008
and by running the same script at 10 August, 2008 the file name will be
archive_10aug2008.zip

Thank you in advance.

Re: Creating file containing current date in its filename

Posted by Kevin Jackson <fo...@gmail.com>.
Hi,

You can use the Tstamp [1] task to store the date in a property, then
read this in the zip task:


<tstamp>
    <format property="tstamped-file-name" pattern="dd-MMM-yy" locale="en,UK"/>
  </tstamp>

<zip destfile="${tstamped-file-name}.zip"
     ...
  />


Thanks,
Kev
[1] http://ant.apache.org/manual/CoreTasks/tstamp.html

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