This might help you Since you are using rmdir without the /S switch I assume the folder of interest is empty, so why removing and recreating it? You could simply create it and suppress the error message in case it already exists, like:
mkdir "folder" 2> nul
rmdir "folder" 2> nul & mkdir "folder"
rmdir /S /Q "folder" & mkdir "folder"
PHP Create Folder (mkdir) auto add number at Folder name?
may help you . I have only one answer for you: don't waste your energy getting 100% code coverage. There are plenty of situations where it's not worth the effort and thus a waste of time and money. Moreover, convoluted tests to cover hard-to-test things like private constructors, exceptions from utility classes or direct interactions with the system (file, network etc) are hard to understand and maintain. They only add technical debt to your application without adding any value at all. Don't write separate unit tests for anemic model classes either (i.e. POJO's with only fields, getters and setters and no logic). These classes should be used elsewhere and covered as part of other tests.
Error in trying to access a file in the sub-folder of my current matlab folder