How to remove an infinitely recurring directory tree?

Solution 1:

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.

Solution 2:

It's possible that there's a Symbolic Link to a folder somewhere, most likely the second student in your path.

Try executing the command:

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

and see whether student is marked as DIR or SYMLINK/JUNCTION.

For example, this is a typical output of the dir command:

04/24/2012  10:58 PM    <DIR>          .
04/24/2012  10:58 PM    <DIR>          ..
04/24/2012  10:58 PM    <SYMLINKD>     a [h:\a]

You see that the first two entries are marked as DIR, while the third (a symbolic link to another folder) is marked as SYMLINKD. In your case (Windows 2003) I think there are JUNCTIONs instead of SYMLINKs.

If the student folder is a symbolic link or junction, run the commands:

cd /d D:\Student\2012\user.name\servername
rmdir student

and thus get rid of the recursion.

Solution 3:

It's possible that whomever was working in that folder manage to create a junction point that loops back up from user.name to servername, thus creating a the 'infinite loop' directory tree.

Junctions are a feature of the NTFS file system that lets you create a symbolic link to a directory that operates as an alias to the directory. http://en.wikipedia.org/wiki/NTFS_junction_point

You can see under the "Observed Effects" section of the wiki page the problem you describe.

Try running this utility to list junctions under that server:

http://technet.microsoft.com/en-us/sysinternals/bb896768

It should also give you the ability to delete the junction point.