Create all directories to a specific point?

I need to be able to create all directories before and include the directory indicated by my File object. For example, suppose I have something like this:

File file = new File( "/var/a/b/c/d/" ); 

But there is only /var/ . I need a method that builds before d , and I was wondering if there is any method in the java io library that does this already.

+4
source share
2 answers

mkdirs() in java.io.File does the trick.

 File file = new File("/var/a/b/c/d"); file.mkdirs(); 
+16
source

File.mkdirs()

+3
source

Source: https://habr.com/ru/post/1306038/


All Articles