Is there something similar to Java's File.length() method? I would like to know 
the immediate disk usage for a directory.

A (1K)

-> B (3k)  
-> C (9k)  


Here, directory A's immediate disk usage is 1k. What proc provides me this 
information?

(Reference Java solution):

public static long diskUsage(File root) {
    long total = root.length();

if (root.isDirectory()) {
    

for (String childname: root.list()) {
    File child = new File(root, childname); total += diskUsage(child);

}

} return total;

}

Reply via email to