Condition is if directory exists it has to create files in that specific directory with out creating a new directory.
The below code only creating a file with new di
java 8+ version
Files.createDirectories(Paths.get("/Your/Path/Here"));
The Files.createDirectories
creates a new directory and parent directories that do not exist.
The method does not thrown an exception if the directory already exist.