Monday, April 18, 2011

How to create directories recursively ?

This can be done through mkdirs() function in File class.

import java.io.File;

public class Main {
   public static void main(String[] args) {
      String directories = "D:\\a\\b\\c\\d\\e\\f\\g\\h\\i";
      File file = new File(directories);
      boolean result = file.mkdirs();
      System.out.println("Status = " + result);
   }
}

No comments:

Post a Comment

Chitika