ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ivan Ivanov <rambiusparkisan...@yahoo.com>
Subject Re: getting file size
Date Mon, 27 Dec 2004 21:44:48 GMT
David, yes it is possible by using javascript:

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

HTH Ivan

--- David Kavanagh <dkavanagh@gmail.com> wrote:

> I'm using ant for a J2ME project and I need to get
> the jar file size
> into my .jad file. So, I was looking for something
> in Ant that might
> let me read the size of a file into a property. I
> couldn't find
> anything! I have no problem writing a custom task,
> but I really hope
> there is something existing that will do this for
> me. Any ideas?
> 
> David
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 



		
__________________________________ 
Do you Yahoo!? 
Jazz up your holiday email with celebrity designs. Learn more. 
http://celebrity.mail.yahoo.com

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


Mime
View raw message