ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ivan Ivanov <rambiusparkisan...@yahoo.com>
Subject Re: Replacing with File Size
Date Wed, 02 Mar 2005 10:21:01 GMT
Sven, 
--- "Haiges, Sven, Vodafone Group R&D"
<Sven.Haiges@vodafone.com> wrote:

> 
> Does anyone know how I can simplay determine the
> byte-size of a file
> from ant and take that output and replace the
> occurrence of @size@ with
> the size determined?

This script does this:
<project>
    <scriptdef name="size" language="javascript">
        <attribute name="file"/>
        <attribute name="property"/>
        <![CDATA[
            importClass(java.io.File);
            f = new File(attributes.get("file"));
           
project.setNewProperty(attributes.get("property"),
f.length());
        ]]>
    </scriptdef>
    <size file="filesize.xml" property="length"/>
    <echo>$${length} is ${length}</echo>
</project>

HTH Ivan
> 
> Thanx a lot for you help.
> 
> Cheers\
> Sven
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 



	
		
__________________________________ 
Celebrate Yahoo!'s 10th Birthday! 
Yahoo! Netrospective: 100 Moments of the Web 
http://birthday.yahoo.com/netrospective/

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


Mime
View raw message