File file = new File("C:\\Directory1");
        if (!file.exists()) {
            if (file.mkdir()) {
                System.out.println("Directory is created!");
            } else {
                System.out.println("Failed to create directory!");
            }
        }

Above code will make directory for you. Append you id in Path will make directory with your " id ".

Answer from Rahul Rabhadiya on Stack Overflow
🌐
Spring
docs.spring.io β€Ί spring-boot β€Ί docs β€Ί 1.2.0.M1 β€Ί reference β€Ί html β€Ί getting-started-first-application.html
10. Developing your first Spring Boot application
If you run mvn dependency:tree again, you will see that there are now a number of additional dependencies, including the Tomcat web server and Spring Boot itself. To finish our application we need to create a single Java file. Maven will compile sources from src/main/java by default so you need to create that folder structure, then add a file named src/main/java/Example.java:
🌐
Samuel Gallo
samuelgallo.com β€Ί home β€Ί best folder structure for a java spring boot project
Best Folder Structure for a Java Spring Boot Project - Samuel Gallo - Full Stack Developer and IT Consultant
September 19, 2023 - my-project-spring/ β”œβ”€β”€ src/ β”‚ β”œβ”€β”€ main/ β”‚ β”‚ β”œβ”€β”€ java/ β”‚ β”‚ β”‚ └── com/ β”‚ β”‚ β”‚ └── minhaempresa/ β”‚ β”‚ β”‚ └── meuapp/ β”‚ β”‚ β”‚ β”œβ”€β”€ config/ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ AppConfig.java β”‚ β”‚ β”‚ β”‚ └── SecurityConfig.java β”‚ β”‚ β”‚ β”œβ”€β”€ controller/ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ HomeController.java β”‚ β”‚ β”‚ β”‚ └── ApiController.java β”‚ β”‚ β”‚ β”œβ”€β”€ model/ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ Usuario.java β”‚ β”‚ β”‚ β”‚ └── Produto.java β”‚ β”‚ β”‚ β”œβ”€β”€ repository/ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ UsuarioRepository.ja
🌐
Stack Overflow
stackoverflow.com β€Ί questions β€Ί 78364946 β€Ί create-directory-on-startup-in-spring-project
java - Create directory on startup in Spring project - Stack Overflow
I am trying to create directories on startup in spring project. The values of the directory are defined in a properties file. I saw this post How to create a directory on statup in spring boot proj...
🌐
YouTube
youtube.com β€Ί codewis technologies by nuhman paramban
File upload in spring boot application Part 1 Creating File Directory - YouTube
File upload using Java nio in Spring Boot ApplicationFile, Path, Directories, copy, exceptionget file name method from java nio file
Published Β  March 26, 2022
Views Β  510
Find elsewhere
🌐
Spring
docs.spring.io β€Ί spring-boot β€Ί docs β€Ί 1.2.3.RELEASE β€Ί reference β€Ί html β€Ί getting-started-first-application.html
11. Developing your first Spring Boot application
If you run mvn dependency:tree again, you will see that there are now a number of additional dependencies, including the Tomcat web server and Spring Boot itself. To finish our application we need to create a single Java file. Maven will compile sources from src/main/java by default so you need to create that folder structure, then add a file named src/main/java/Example.java:
🌐
Java Development Journal
javadevjournal.com β€Ί home β€Ί how to create directory in java
How to create directory in Java | Java Development Journal
June 14, 2017 - How to create directory in Java using java.nio and using Files class.How to use Apache Commons FileUtils for creating directory.
🌐
Symflower
symflower.com β€Ί en β€Ί company β€Ί blog β€Ί 2024 β€Ί spring-boot-folder-structure
Spring Boot folder structure best practices
March 9, 2024 - Find out how to set up a coherent and logical folder structure in your Spring Boot projects.
🌐
Medium
medium.com β€Ί @jagritisrvstv β€Ί spring-boot-folder-structure-fa22c1ee3624
Spring boot folder structure. Spring Boot projects follow a standard… | by Jagriti Srivastava | Medium
December 15, 2024 - Spring Boot projects follow a standard directory layout, which facilitates organizing code in a way that makes it easy to manage and scale. Here’s a typical structure for a Spring Boot application: project-root/ β”œβ”€β”€ src/ β”‚ β”œβ”€β”€ main/ β”‚ β”‚ β”œβ”€β”€ java/ β”‚ β”‚ β”‚ └── com/ β”‚ β”‚ β”‚ └── example/ β”‚ β”‚ β”‚ └── project/ β”‚ β”‚ β”‚ β”œβ”€β”€ ProjectApplication.java β”‚ β”‚ β”‚ β”œβ”€β”€ controller/ β”‚ β”‚ β”‚ β”‚ └── HomeController.java β”‚ β”‚ β”‚ β”œβ”€β”€ service/ β”‚ β”‚ β”‚ β”‚ └── HomeService.java β”‚ β”‚ β”‚ β”œβ”€β”€ repository/ β”‚
🌐
Medium
medium.com β€Ί @baluchowdary8 β€Ί mastering-spring-boot-folder-structure-what-every-devops-engineer-needs-to-know-5b4a34ab3015
Mastering Spring Boot Folder Structure: What Every DevOps Engineer Needs to Know! | by BALA KRISHNA CHERUKURI | Medium
March 18, 2025 - Classes in this folder are typically annotated with @Configuration, defining beans and dependency injections. Manages CORS policies, authentication mechanisms, and third-party service configurations. Supports Spring Profiles, allowing different configurations for Dev, QA, and Prod environments.
🌐
Stack Overflow
stackoverflow.com β€Ί questions β€Ί 72351250 β€Ί how-can-i-create-a-folder-and-a-file-before-spring-boot-application-load-the-app
java - How can I create a folder and a file before spring boot application load the application.propeties - Stack Overflow
May 23, 2022 - Bring the best of human thought and AI automation together at your work. Explore Stack Internal ... We have a spring boot application that uses an application.properties file that contains two values that are similar to: file.file=folder/name.jks file.file2=folder2/name2.jks
🌐
GeeksforGeeks
geeksforgeeks.org β€Ί java β€Ί how-to-create-a-directory-in-java
How to Create a Directory in Java? - GeeksforGeeks
July 23, 2025 - This article will guide you through the process of creating a directory in Java, providing step-by-step examples and explanations.
🌐
Medium
ravindrandharshan.medium.com β€Ί understanding-the-basic-folder-structure-of-a-spring-boot-application-bedaaa0e6f3b
Understanding the Basic Folder Structure of a Spring Boot Application | by Ravindran Dharshan | Medium
November 14, 2024 - When you create a Spring Boot application, either using Spring Initializr or manually setting up a Maven/Gradle project, the generated folder structure is designed to follow best practices for modern Java applications.
🌐
Stack Overflow
stackoverflow.com β€Ί questions β€Ί 24790398 β€Ί create-file-inside-folder-resources-of-spring-project
java - Create file inside folder "resources" of spring project - Stack Overflow
In my current spring, some forms have a field where the user can upload a file, which should be saves inside the folder resources from project (src/main/resources, following the structure created by maven).
🌐
DEV Community
dev.to β€Ί imajenasyon β€Ί folder-structure-backend-java-2402
Folder structure - backend java - DEV Community
April 8, 2025 - Creating an organized folder structure for your backend project is essential for maintainability, scalability, and ease of collaboration. Here’s an extensive folder structure that would work well for a backend project, particularly if you're using Spring Boot with Java (which is a common ...