Recursively create directory

前端 未结 10 591
萌比男神i
萌比男神i 2020-12-30 23:20

Does anyone know how to use Java to create sub-directories based on the alphabets (a-z) that is n levels deep?

 /a
    /a
        /a
        /b
        /c
           


        
10条回答
  •  一整个雨季
    2020-12-30 23:35

    You can simply use the mkdirs() method of java.io.File class.

    Example:

    new File("C:\\Directory1\\Directory2").mkdirs();
    

提交回复
热议问题