The other day I was trying to robocopy my user profile from my C drive to my backup drive before a restore and forgot about the junction links and the /XJ switch of robocopy.  Long story short, robocopy got stuck in a loop on Application Data for about an hour before I noticed and created these monstrous paths that Windows could not delete, similar to this (and much worse):

E:\Backups\Robocopy\user1\AppData\Local\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Google\Chrome\User Data\Default\PepperData\Shockwave Flash\WritableRoot\#SharedObjects\78EMHNB6\launch.newsinc.com\55\js\lib\

Even after trying several variations of del and rmdir at the command prompt, the solution was as easy as creating the problem:

  • Just create an empty directory and use robocopy to mirror the empty directory over the directory that won't delete...before finally deleting the problem directory.

For example, in using the path above:

  1. Create an empty directory (e.g. mkdir E:\user1 ... or just create user1 dir with Windows Explorer)
  2. Mirror the directory created in step 1 to the problem directory (e.g. robocopy E:\user1\  E:\Backups\Robocopy\user1\ /MIR) and wait for it to finish.
  3. Delete the problem directory and your empty directory. (e.g. rmdir E:\Backups\Robocopy\user1 ... and rmdir E:\user1 ...  or just delete both directories with Windows Explorer)

Hope this helps someone.  However, I'm sure it will help me again in the future when I'm trying to remember how I solved this.  This wasn't the first time I've run into this issue and I'm sure it won't be the last.

Comments


Comments are closed