Windows – How to remove an infinitely recurring directory tree

windows

On one of our Windows 2003 file servers somehow someone or something managed to create infinitely recurring directory trees within some of the users' home folders, and they can't be deleted.

You wind up with something like this:

D:\Student\2012\user.name\servername\student\2012\user.name\servername\student\2012\...

And it continues infinitely as far as I've been able to tell.

Trying to delete the directory tree from the system it resides on results in "Error deleting file or folder: Cannot delete file: ". Trying to delete it from a Windows 7 system connected to the network share results in a "folder in use" error.

If you navigate down the directory tree as far as you go you eventually reach a directory that cannot be opened or deleted (if right clicked none of the standard options appear), however if you try to open the same directory from a share on another system it can be opened, however Windows Explorer becomes extremely slow.

I've tried the suggestions in this post, as well as booting the server with a Linux disc and trying to rm -rf the directory, neither worked.

It is a mystery.

Edit: I might also add that it's possible to rename the directories, just not remove them.

Best Answer

I also had an endlessly recursive folder that had been created by a java IDE, and I was unable to delete it in either Windows Explorer or at the cmd prompt.

However, when I installed git I also installed git-bash. In git-bash you can issue the command:

rm -rfd recursive_folder_name

and it will take care of it.

Related Question