Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

3 Answers 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.

share|improve this answer

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.

share|improve this answer
    
None of the directories are symlinks, I checked the first couple plus the one at the "end" where it gets stuck. –  EnglishInfix Apr 24 '12 at 20:27

I had a similar problem when eclipse created a massively deep folder tree which I couldnt delete. However since it was possible to move and rename folders I wrote a batch file to work it's way down the tree deleting folders one at at time and this worked! For a apparently infinately deep folder tree of FOLDERNAME in the C directory, i.e.

C:/*FOLDERNAME*/*FOLDERNAME*/*FOLDERNAME*/*FOLDERNAME*/*FOLDERNAME*/*FOLDERNAME*/...

Batch file :

:LoopStart
REN "C:/*FOLDERNAME*" "*TEMPFOLDERNAME*"
MOVE "C:/*TEMPFOLDERNAME*/*FOLDERNAME*" "C:/"
RMDIR /S /Q "C:/*TEMPFOLDERNAME*"
GOTO LoopStart
:LoopEnd

This works because TEMPFOLDERNAME is now a tree of finite length (a single folder with nothing in it) and the massive FOLDERNAME tree has one less folder every time the loop is run, eventually reaching the bottom by removing a folder at the top.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.