A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.tutorialspoint.com/javaexamples/dir_create.htm below:

How to create directories recursively in Java

How to create directories recursively in Java 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

java_directories.htm


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4