Black Hole Method - Delete folders that are deeper than MAX_PATH characters

hohaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

 

after searching all THE INTERNET FOR A SOLUTION I DIDNT FIND ANY.

here is one that i invented :

 

Concept:

========

1- create a vhd file using disk management. we will call that vhd a black hole vhd.

2- use robocopy to move the entire long path folder to the black hole

3- delete the black hole

 

Steps:

=====

1- right click my computer

2- choose manage

3- select disk management

4- from "more actions" menu on the right

5- choose create vhd and put it anywhere

6- go down to the disk and right click and choose initialize then format

6- use robocopy with the /move switch

  example : robocopy C:\users\[userx]\AppData  H:\blackhole.vhd /s /move

7- after robocopy completes

8- goto disk management

9-right click the disk and choose detach vhd

10- goto the vhd and delete it

Comments

  • Anonymous
    February 26, 2011
    Thanks man,  I've spent almost 3 hours trying to delete some ridiculous directory.  It was over 800 folders deep and the robocopy method to the vhd was the only way that i got to work.  

  • Anonymous
    October 06, 2011
    You don't even need a VHD to make use of robocopy's ability to manage paths longer than MAX_PATH. Create an empty folder like "c:empty", then use the mirroring option of robocopy to mirror your empty folder into the folder that you want to delete: robocopy c:Empty c:FolderContainingTooLongPaths /MIR

  • Anonymous
    March 19, 2015
    Christophe.. it's what Hussein Ahmad meant.. it's a "solution" which does not work... Robocopy just skips it. I tried everything except his method now. Sadly robocopy is still moving the files.. for 5mins now!