Web | This Site

Java Basics Examples
Java Tutorial
Java Useful Resources
Selected Reading
© 2011 TutorialsPoint.COM

| Home |  | References |  | Discussion Forums |  | About TP

# Java Examples - Create directories recursively

## Problem Description:

How to create directories recursively ?

## Solution:

Following example shows how to create directories recursively with the help of file.mkdirs() methods of 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);
       }
    }

## Result:

The above code sample will produce the following result.

    Status = true

Advertisement

Online Image Processing

Indian Baby Names