1

I had a bug in my java app, which created a folder structure, which never ends..

So i have afolder structure like

C:/folder/folder/folder/folder/folder/.../...

Now I am not able to delete this folder anymore. Any ideas?

Oliver Salzburg
  • 86,445
  • 63
  • 260
  • 306
Tassilo Posegga
  • 371
  • 3
  • 7
  • have you tried rmdir from the command line? – Frank Thomas May 08 '13 at 12:12
  • Yep, it says the file is use by another process, although I rebooted before – Tassilo Posegga May 08 '13 at 12:13
  • well, per MS, it should be trivial to delete hard and soft links, so I'm surprised you'd get that response. http://www.howtogeek.com/howto/windows-vista/using-symlinks-in-windows-vista/ – Frank Thomas May 08 '13 at 12:19
  • @TassiloPosegga - First I would reboot your system. I would then use the great tool http://download.cnet.com/Unlocker/3000-2248_4-10493998.html to delete the folder and its contents. – Ramhound May 08 '13 at 12:31
  • 1
    Yeah all I got with this great tool was a nice toolbar, when uninstalling it. – Tassilo Posegga May 08 '13 at 14:48
  • If the folder structure truly never ends, that's what we call file system corruption. If instead there's just 12,500+ deep folder levels, then worst case you could probably boot from a live CD of some *nix OS and remove it in there. Or, probably the easiest, write a different java app using the same APIs to remove it. You might have to write it to call itself recursively and maybe output the depth it reaches each time it calls itself until it hits a stack overflow, then limit it to about 10 instances before then and start removing folders. – Mark Allen May 08 '13 at 18:34

2 Answers2

0

You can try PowerShell instead of DOS. I'm sure DOS probably has a lower maximum recursion depth than PowerShell.

Remove-Item -Recurse -Force c:/folder

You can also try Robocopy.

Create a directory in c:\folder called temp

Run robocopy c:\temp c:\folder /purge

If none of that works here is another solution: https://serverfault.com/questions/230119/massive-amount-of-subfolders-and-long-subfolders-how-can-i-delete-all-of-them

Travis
  • 1,054
  • 8
  • 16
  • "I'm sure DOS probably has a lower maximum recursion depth than DOS" - Sure and Probably in the same sentence? Anyway, if you were going for a recursive statement looks like you succeeded! :) – Karan May 10 '13 at 20:32
  • Fixed it. That's what happens in a rush. – Travis May 13 '13 at 14:21
0

Try pressing SHIFT + DEL on the root directory which will permanently delete the folder(s).

Hope that helps you :)

Sazid
  • 101
  • 2