1

Is there any simple way to find broken ntfs symbolic links in windows and delete them? (other than manual search and destroy)

I'm in this mess because of windows home server's inability to upgrade without removing disks :/ and the files are scattered randomly on a bunch of disks (but the structure is intact and mirrored on all disks)

possan
  • 153
  • 1
  • 4
  • Are you sure you are talking about symbolic links? AFAIK NTFS can do real symbolic links (http://en.wikipedia.org/wiki/NTFS_symbolic_link) but there isn't a GUI for it. Or are you talking about those .lnk files? – serverhorror Jun 14 '09 at 21:22
  • it seems to be what they call "hard links" because it's the files that's linked, and not the folders... quote from the junction link magic page: "if you just want to link a file instead of a folder, this is called a hard link" - i think i'm going to just walk the directory tree with powershell stat'ing every file to see if it's accessible or not. – possan Jun 15 '09 at 18:41

2 Answers2

2

I use Junction Link Magic:

http://www.rekenwonder.com/linkmagic.htm

It's got a very easy to use GUI interface which will find all the symlinks and junctions, and give you the status of each.

Mark Henderson
  • 68,823
  • 31
  • 180
  • 259
2

i ended up with this quick and dirty powershell script, which traverses the directory tree and looks for files that are zero bytes, and then asks if it should delete each one of those, it works for my purposes atleast.


function walk( $path ) {
        echo "walking $path ..."
        dir $path | ForEach-Object {
                if( $_.Attributes -like '*Directory*' )
                { walk( $_.FullName ); }
                else {
                        $size = [math]::Round( $_.Length )
                        if( $size -like '0' ) { $_ | remove-item -confirm }
                }
        }
}

if( $args.Length -like 0 ) { echo "Syntax: walk c:\\" }
else { walk( $args[0] ) }

maybe it's helpful to somebody...

possan
  • 153
  • 1
  • 4