[Tutor] Deleting recursive folder definition

Mark Tolonen metolone+gmane at gmail.com
Mon Jan 12 22:38:05 CET 2009


"Alan Gauld" <alan.gauld at freenet.co.uk> wrote in message 
news:50C11A8B9DB748FA9E6E892067CCE014 at xp...
> I've managed to do something incredibly stupid on my XP box.
> I've created a folder that is a link to itself - at least I think that's 
> what has
> happened, it was a CASE tool that I was using that actually did the 
> damage.
>
> The symptoms are that I can "infinitely" navigate down to the next level.
> I can also delete as many folders as I like but the top level properties
> still report 232 folders... Also I get error messages on the defective
> folder saying the filename(ie path) is too long.
>
> I've tried using Cygwin rm, I've tried renaming the folder to a shorter
> name., I've tried using the DOS DEL command.
>
> My last resort is to try to write a program to do it, but how?
> Does anyone know enough about Windows filesystem (NTFS) to know
> which API calls etc I would need? Or is there a better solution?
> I'm not even sure this approach will work since it will just recurse
> to inifinity too I suspect!
>
> The MSDN and Knowledge Base don't seem to offer any advice either...
>
> Any ideas?

It sounds as if you've created an "NTFS junction point."  The XP Help topic 
shows 3 utilities that may help:

Microsoft offers three utilities for creating and manipulating NTFS junction 
points:
Linkd.exe
  a.. Grafts any target folder onto a Windows 2000 version of NTFS folder
  b.. Displays the target of an NTFS junction point
  c.. Deletes NTFS junction points that are created with Linkd.exe
  d.. Location: Microsoft Windows 2000 Resource Kit
Mountvol.exe
  a.. Grafts the root folder of a local volume onto a Windows 2000 version 
of NTFS folder (or "mounts" the volume)
  b.. Displays the target of an NTFS junction point that is used to mount a 
volume
  c.. Lists the local file system volumes that are available for use
  d.. Deletes the volume mount points that are created with mountvol.exe
  e.. Location: Windows 2000 CD-ROM in the I386 folder
Delrp.exe
  a.. Deletes NTFS junction points
  b.. Also deletes other types of reparse points, which are the entities 
that underlie junction points
  c.. Aimed primarily at developers who create reparse points
  d.. Location: Microsoft Windows 2000 Resource Kit
Linkd or Delrp sound like what you may need.  If you want to fix the problem 
programmatically, try looking up:

DeviceIoControl
FSCTL_GET_REPARSE_POINT
FSCTL_DELETE_REPARSE_POINT
FSCTL_SET_REPARSE_POINT

-Mark

-Mark




More information about the Tutor mailing list