I want to create a new directory. If it doesn't exist - create it. if it exists - I want to "reset"/"truncate" the directory. In other words, I want to get an empty directory
My problems are -
- I read that to check an existence of a directory to decide whether or not to create it is a bad practise, so I can't determine what should I do next. You can read the explanation about why it is a bad practise in How to create a directory in Java?
- I can iterate over all the files and delete them, but I'm looking for a more elegant approach.