adsense


Showing posts with label JAVA EXAMPLES DIRECTORY SIZE. Show all posts
Showing posts with label JAVA EXAMPLES DIRECTORY SIZE. Show all posts

Wednesday, 28 October 2015

JAVA EXAMPLES DIRECTORY SIZE PAGE 116

COMPUTER LANGUAGES HTML,C,C++.JAVA,.NET AND MULTIMEDIA basics and programs click home button



JAVA EXAMPLES DIRECTORY SIZE






Java Examples - Directory Size


Problem Description:
How to get the size of a directory?
Solution:
Following example shows how to get the size of a directory with the help of FileUtils.sizeofDirectory(File Name) method of FileUtils class.
import java.io.File;
import org.apache.commons.io.FileUtils;

public class Main {
   public static void main(String[] args) {
      long size = FileUtils.sizeOfDirectory
      (new File("C:/Windows"));
      System.out.println("Size: " + size + " bytes");
   }
}
Result:
The above code sample will produce the following result.
Size: 2048 bytes


JAVA EXAMPLES DIRECTORY SIZE PAGE 109

COMPUTER LANGUAGES HTML,C,C++.JAVA,.NET AND MULTIMEDIA basics and programs click home button



JAVA EXAMPLES DIRECTORY SIZE






Java Examples - Directory Size


Problem Description:
How to get the size of a directory?
Solution:
Following example shows how to get the size of a directory with the help of FileUtils.sizeofDirectory(File Name) method of FileUtils class.
import java.io.File;
import org.apache.commons.io.FileUtils;

public class Main {
   public static void main(String[] args) {
      long size = FileUtils.sizeOfDirectory
      (new File("C:/Windows"));
      System.out.println("Size: " + size + " bytes");
   }
}
Result:
The above code sample will produce the following result.
Size: 2048 bytes