File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes I/O and Streams and the fly likes How to get hte size of the folder[urgent] Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "How to get hte size of the folder[urgent]" Watch "How to get hte size of the folder[urgent]" New topic

How to get hte size of the folder[urgent]

netharam ram
Ranch Hand

Joined: Aug 09, 2001
Posts: 202
Hi I want to get the size of the folder & also display the size of the sub folders too.Is there any simpler way to do so?I have an idea of adding the files present in the current sub-directory,display it as the size of that directory ,then add it with the size of the parent directory & display that as the size of the parent directory.Please suggest me if u have some better idea,also tell me how to manage the list of directories & sub-directories of a drive,since they exist in large numbers.
Happy middling with java.
Harish Kashyap
Ranch Hand

Joined: Jun 14, 2000
Posts: 118
u r thinking the right way....
don't waste your time searching for short-cuts...
you have to load a directory then list it and sum the size of each file it contains...
I agree. Here's the link:
subject: How to get hte size of the folder[urgent]
Similar Threads
Scan files which having wild cards using apache DirectoryScanner
Scanning a whole directory?
How to Generate a War file
dynamically accessing the files from different directories
file names of files in a url