Search code examples
javajsondirectorysubdirectory

how to create a Folder inside a folder in java


I have tried to find the path of an existing folder in the same maven project package and create another folder from it.

the existing folder is called client101.userinfo i have tried to do:

File dir = new File("client101.userinfo/userdat");

what am I doing wrong?


Solution

  • You need to use method mkdirs()

    new File("/path/directory").mkdirs();
    

    "directory" is the name of the directory you want to create.