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: TimeStamp
Date Thu, 04 May 2006 06:04:35 GMT
AFIK there is none in Ant or AC - maybe there is an external task. 
But you could use scripting for that. I modified an old example for getting the filesize:

<project>

    <scriptdef name="getfd" language="javascript">
        <attribute name="file"/>
        <attribute name="property"/>
        <![CDATA[
            fileName = attributes.get("file");
            propName = attributes.get("property");

            file = new java.io.File(fileName);
            date = java.text.DateFormat.getDateTimeInstance().format(new java.util.Date(file.lastModified()));
            
            project.setNewProperty(propName, date);
        ]]>
    </scriptdef>

    <getfd file="build.xml" property="buildfile.date"/>
    <echo>date of buildfile is ${buildfile.date}</echo>

</project>



Jan

>-----Urspr√ľngliche Nachricht-----
>Von: ankur1.a@tcs.com [mailto:ankur1.a@tcs.com] 
>Gesendet: Donnerstag, 4. Mai 2006 07:20
>An: Ant Users List
>Betreff: TimeStamp
>
>
>hi ,
>
>can anyone tell me how can i get the timestamp of a file in a 
>property..i am not getting the task for it.
>
>
>Ankur Agarwal
>Tata Consultancy Services Limited
>Mailto: ankur1.a@tcs.com
>Website: http://www.tcs.com
>
>Notice: The information contained in this e-mail message 
>and/or attachments to it may contain confidential or 
>privileged information.   If you are not the intended 
>recipient, any dissemination, use, review, distribution, 
>printing or copying of the information contained in this 
>e-mail message and/or attachments to it are strictly 
>prohibited.   If you have received this communication in 
>error, please notify us by reply e-mail or telephone and 
>immediately and permanently delete the message and any 
>attachments.  Thank you
>

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


Mime
View raw message