-
How to find the Directory size including sub directories
Abdul,
Try this.
public long getSize(File source,long size){
try{
if (source.isDirectory()){
File [] filesInThisDir = source.listFiles();
for (int i=0;i<filesInThisDir.length;i++){
size=size+filesInThisDir[i].length();
getSize(filesInThisDir[i],size);
}
}
else{
size=size+source.length();
}
}
catch(Exception e){
e.printStackTrace();
}
return size;
}
Cheers,
Anjan Sharma (Vimon)
"Abdul" <rahuman_k@yahoo.com> wrote:
>
>
>How to find the Directory size including sub directories
>Is there and predefined methods...
>if not please send me the efficent java code to find the
>diorectory size(imp: it should include the subdirectory)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks