Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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)

share|improve this question
Are you sure you are talking about symbolic links? AFAIK NTFS can do real symbolic links ( but there isn't a GUI for it. Or are you talking about those .lnk files? – Server Horror 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

I use Junction Link Magic:

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.

share|improve this answer
I normally just do these by hand - thanks for the info about is tool. – Preet Sangha Jun 14 '09 at 21:30

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

share|improve this answer
PS scripts are always welcome! – Mrchief Apr 19 '13 at 15:30

Your Answer


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.