jQuery in Action, 2nd edition*
The moose likes I/O and Streams and the fly likes File properties Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "File properties" Watch "File properties" New topic
Author

File properties

Ransika deSilva
Ranch Hand

Joined: Feb 18, 2003
Posts: 524
Hello,
Could you please tell me how to get the properties of a File,Folder. I want to get the specially the File/Folder size etc.
Thank you...


SCJP 1.4, SCMAD 1.0<br />SCWCD, SCBCD (in progress)
Ali Gohar
Ranch Hand

Joined: Mar 18, 2004
Posts: 572
See the File class specification from http://java.sun.com

You can get the size of the file using File class object

File f = new File("test.txt");
long size = f.length();
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Moving this to the I/O and Streams forum...


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: File properties