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"
![RoboCopy Mirror Example - How to delete stubborn folders](https://cdn.woodward.digital/wp-content/uploads/2021/03/RoboCopyMirPS-1.png?strip=all&lossy=1&ssl=1)
To find out more about RoboCopy please visit:
https://social.technet.microsoft.com/wiki/contents/articles/1073.robocopy-and-a-few-examples.aspx