Published

Sat 24 Aug 2013 @ 06:57 PM

←Home

Deleting Windows Deep Directory Trees

Occasionally in the past I have tried copying a directory tree from one Windows based system to another. In the process, overly deep directory trees are created due to NTFS reparse points, which are like posix symbolic links but only apply to directories. By the time I realize what I've done, it is too late to "easily" fix the problem: the damage has been done.

This happened to me today, and I finally cobbled together a solution. I do not claim that this solution will work for everyone (or anyone, for that matter). If it helps you, great. Mainly I'm posting it for myself for future reference for the next time I do this.

rem put this in a batch file
rem adapt to fit your circumstances
rem run as many times as needed to delete everything
ren "Application Data" "Application Data Old"
attrib -H -S "Application Data Old\Application Data"
move "Application Data Old\Application Data" .
rmdir "Application Data Old"
rmdir /s /q "Application Data"
Go Top