How to solve “The directory is not empty” error when running rmdir command in a batch script?

前端 未结 13 2241
悲&欢浪女
悲&欢浪女 2021-01-30 02:16

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

13条回答
  •  别那么骄傲
    2021-01-30 02:35

    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
    

提交回复
热议问题