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
I just encountered the same problem and it had to do with some files being lost or corrupted. To correct the issue, just run check disk:
chkdsk /F e:
This can be run from the search windows box or from a cmd prompt. The /F fixes any issues it finds, like recovering the files. Once this finishes running, you can delete the files and folders like normal.