简体   繁体   中英

How to create a folder inside the resource folder in SpringBoot app?

I have a SpringBoot app where I read a folder of the resource folder of the app. but I would like to know if it is possible also to create a folder in the resource folder

File folderFrom = ResourceUtils.getFile("classpath:icons/svg/white/");

something like

File folderTo = ResourceUtils.createFolder("classpath:icons/svg/black/");

I trying to do it from Eclipse:

@SpringBootApplication
public class SvgManagerApplication implements CommandLineRunner {

    public static void main(String[] args) {
        SpringApplication.run(SvgManagerApplication.class, args);
    }


    @Override
    public void run(String... args) throws Exception {      
      ..
    }
}   

You can use java.utils to create a folder inside the resource directory

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

"directory" is the name for the folder you want to create

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM