Page 1 of 1

How to tell a junction from a directory?

Posted: Wed Nov 23, 2011 11:49 pm
by pthien
I have a program that looks at every file on a hard drive. On Vista or 7 machines it gets stuck with junctions, I think. I think I get stuck in a loop when I encounter junctions because I think they are directories and keep following them deeper and deeper.

Any idea how to avoid this? Is there a test to see if a directory entry is a junction?

Re: How to tell a junction from a directory?

Posted: Thu Nov 24, 2011 12:31 am
by IdeasVacuum
Before parsing the drive, make a list of the junction points. Your code can then check the list to avoid them.

Junction points are specifically Win2000/XP - Vista and Win7 are using the more advanced 'Symbolic links'. There's a smorgasbord Wiki about it:
http://en.wikipedia.org/wiki/NTFS_junction_point

Re: How to tell a junction from a directory?

Posted: Thu Nov 24, 2011 10:32 am
by em_uk
The problem he is coming up against is testing whether the folder is a junction/symbolic link.

Re: How to tell a junction from a directory?

Posted: Thu Nov 24, 2011 3:55 pm
by pthien
Okay, wait. Here is the problem:

me <= dumb.

The problem I was having wasn't getting caught in junctions, it was the fact that this particular hard drive I was working on had at least a dozen "Temporary Internet Files" folders with hundreds of thousands of files. Once you have more than about 10k files in a folder, NTFS has performance issues.

So once I found that and removed all that crap, my app worked as expected.

I guess I would still like to know how PB handles junctions and symbolic links. Does it ignore these?

Re: How to tell a junction from a directory?

Posted: Thu Nov 24, 2011 4:47 pm
by IdeasVacuum
I do not know if PB can handle junctions as anything other than a real folder. In the Wiki, a system command is given for listing them.

Re: How to tell a junction from a directory?

Posted: Thu Nov 24, 2011 5:31 pm
by jpd
Hi pthien,

here a symbolic link... :-) that handle junctions and symbolic links

viewtopic.php?f=12&t=37028&hilit=reparse

Best
jpd

Re: How to tell a junction from a directory?

Posted: Thu Nov 24, 2011 10:42 pm
by Blood
What is a junction?

Re: How to tell a junction from a directory?

Posted: Thu Nov 24, 2011 11:36 pm
by luis
Blood wrote:What is a junction?
http://en.wikipedia.org/wiki/NTFS_junction_point

Re: How to tell a junction from a directory?

Posted: Thu Nov 24, 2011 11:39 pm
by IdeasVacuum
A junction is less confusing than a roundabout for American friends visiting the UK.............

Re: How to tell a junction from a directory?

Posted: Thu Nov 24, 2011 11:57 pm
by Zach
We have plenty of roundabouts (we call them traffic circles). I don't know why people find them so damn hard to figure out though, especially with all the signs posted and lane markers + arrows on the road.

But still, idiots go in using one lane, and switch to another halfway through, enter the circle when traffic is coming around in the proper lane (NOT the exit lane), and no one can seem to tell which lane they are supposed to be in.


It really pisses me off. I'm going to die going through one of them one day :x

Re: How to tell a junction from a directory?

Posted: Fri Nov 25, 2011 4:30 am
by RASHAD

Re: How to tell a junction from a directory?

Posted: Fri Nov 25, 2011 8:32 pm
by Blood
luis wrote:
Blood wrote:What is a junction?
http://en.wikipedia.org/wiki/NTFS_junction_point
Thanks! Looks like microsoft's attempt at recreating a symbolic link and failing badly! lol! When will microsoft learn. he he,... :mrgreen:

Re: How to tell a junction from a directory?

Posted: Fri Nov 25, 2011 10:35 pm
by skywalk

Re: How to tell a junction from a directory?

Posted: Sat Nov 26, 2011 4:39 am
by IdeasVacuum
:mrgreen: I like the Kitt advert too :oops: