Create directory with parent directories with java



User Rating:  / 2
PoorBest 
Details

Simple code for create directory with parrents direcory.

e.g. :  c:\dir1\dir2\dir3\direcory

View source
package com.developerpages.snippets.core;
 
import java.io.File;
 
public class CreateDirectoryWithParentDirectories {
 
    public static void main(String[] args) {
        File dir = new File("c://dir1/dir2/dir3/directory");
        boolean directoriesCreated = dir.mkdirs();
        if (directoriesCreated) {
            System.out.println("Directories created");
        } else {
            System.out.println("Directories not created");
        }
 
    }
}
 


You have no rights to post comments

   

Login  

   

     

© Developerpages