I am making a batch script and part of the script is trying to remove a directory and all of its sub-directories. I am getting an intermittent error about a sub-directory not be
What worked for me is the following. I appears like the RMDir command will issue “The directory is not empty” nearly all the time...
:Cleanup_Temporary_Files_and_Folders Erase /F /S /Q C:\MyDir RMDir /S /Q C:\MyDir If Exist C:\MyDir GoTo Cleanup_Temporary_Files_and_Folders