Reputation:
Can someone tell me how to delete previous runtime operations on static Resources in Eclipse/Spring.
imageDir=new File("C:\\Users\\lukas\\workspace\\uploadingFiles\\src\\main\\resources\\static\\images");
Every next run must reset all previous runs operations in my resources
I am using Gradle(STS). Commands I used with my project(CMD Console):
gradlew wrapper
gradle build
gradlew bootrun //every time I use this command to run Spring Boot
taskkill /F /PID <PID_NUMBER> //command to stop application
Upvotes: 1
Views: 191
Reputation: 1038
use Apache Commons IO.
FileUtils.forceDeleteOnExit(new File("C:\\Users\\lukas\\workspace\\uploadingFiles\\src\\main\\resources\\static\\images"));
Schedules a file to be deleted when JVM exits.
Upvotes: 1