How to delete stubborn folders using Robocopy in Windows. By using Robocopy to “mirror” an empty folder using the /MIR command.
What is RoboCopy? Robocopy is a free command-line file copy utility that has shipped with Windows since Vista.
To delete a stubborn folder and all its subfolders and files:
1) Create an empty folder.
2) Open PowerShell.
3) Run the following command:
Robocopy /MIR “<Path to empty folder>” “<Path to delete>”
Note: This will delete all files and folders within the folder path that you specify.
Example:
Robocopy /MIR "C:\Empty" "C:\Stuck\Stubborn\Folder"
To find out more about RoboCopy please visit:
https://social.technet.microsoft.com/wiki/contents/articles/1073.robocopy-and-a-few-examples.aspx