Recursive evaluation of the size of a folder

Establish a path to any object the size of this strike a path to the folder:
public class the Test {

public static void main (String [] args) throws IOException {
// Create a file object
File file = new File ( "D : \\ JavaSE ");
System.out.println (method (file));
}
// methods seeking to write the file size
public static Long method (file file) {
Long Line = 0L;
IF (file.isDirectory ()) {
file [] files File.listFiles = ();
for (file1 File: Files) {
Line = Method + (file1);
}
}
return Line file.length + = ();
}
}

Guess you like

Origin www.cnblogs.com/robotsu/p/11525402.html