Thursday, March 20, 2008

Use Time Stamp to Create Files or Folder Using Ant

Every now and then we come across a situation where we are in a need of creating folder with the name of time stamp so that we can keep record of every execution, don't we ;-) ?
Its fairly easy to accomplish this in Ant
use tstamp task.
This is how a set a property "START_TIME" and use it to create that file/folder.
<tstamp>
<format property="START_TIME" pattern="dd_MMM_yy_HH_mm_ss"/>
</tstamp>

Like
<property name="testresults-folder" value="${START_TIME}_TestResults"/>
and create a folder by this property
<mkdir dir="${testresults-folder}"/>

1 comment:

  1. This comment has been removed by a blog administrator.

    ReplyDelete