I was just wondering if the code I made will work to create multiple directories within each other. I used this as a reference.
String username = enterUserTF.getText(); //the username the user enters in a textfield. boolean myGamesFolderSuccess = new File(System.getProperty("user.home"), "My Games").mkdir(); boolean mainFolderSuccess = new File("My Games", "Type King").mkdir(); boolean userSuccess = new File("TypeKing", username).mkdir(); //creates a folder with the users username. if(myGamesFolderSuccess){ if(mainFolderSuccess){ if(userSuccess){ System.out.println("Directory " + username + " created."); File f = new File(username + "/test.txt"); if(!f.exists()){ try { f.createNewFile(); } catch (IOException e) { e.printStackTrace(); System.out.println("Could not create user's file."); } } } } } } So to sum up the above, I made the the first directory "My Games" in user.home, then placed my game's name, "Type King" in that directory, and whenever the user enters a username, I want a directory to be created that is their username. File f just checks for a file in the username directory.