How do I get a file size?
1 posts in topic
Flat View  Flat View

Posted By:   William_Gates
Posted On:   Tuesday, April 16, 2002 10:19 PM

I would imagine that this is fairly simple, but how do I get the size of a local file, without reading it into memory. I have looked everywhere, but no luck.

Also, is there a simple way to get the size of all the files in a directory?

Re: How do I get a file size?

Posted By:   Thomas_Hackel  
Posted On:   Wednesday, April 17, 2002 01:42 AM

VERY EASY... just read the API documentation. use the java.io.File class. it has a length() method, and it has also methods to get all files in a directory... so its very easy to write a method which calculates the size of all in this directory (and maybe recursive, all directories below too)
About | Sitemap | Contact