How to tell a junction from a directory?
How to tell a junction from a directory?
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?
Any idea how to avoid this? Is there a test to see if a directory entry is a junction?
-
IdeasVacuum
- Always Here

- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: How to tell a junction from a directory?
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
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
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: How to tell a junction from a directory?
The problem he is coming up against is testing whether the folder is a junction/symbolic link.
----
R Tape loading error, 0:1
R Tape loading error, 0:1
Re: How to tell a junction from a directory?
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?
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?
-
IdeasVacuum
- Always Here

- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: How to tell a junction from a directory?
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.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: How to tell a junction from a directory?
Hi pthien,
here a symbolic link...
that handle junctions and symbolic links
viewtopic.php?f=12&t=37028&hilit=reparse
Best
jpd
here a symbolic link...
viewtopic.php?f=12&t=37028&hilit=reparse
Best
jpd
PB 5.10 Windows 7 x64 SP1
Re: How to tell a junction from a directory?
What is a junction?
C provides the infinitely-abusable goto statement, and labels to branch to. Formally, the goto is never necessary, and in practice it is almost always easy to write code without it. We have not used goto in this book. -- K&R (2nd Ed.) : Page 65
Re: How to tell a junction from a directory?
http://en.wikipedia.org/wiki/NTFS_junction_pointBlood wrote:What is a junction?
"Have you tried turning it off and on again ?"
-
IdeasVacuum
- Always Here

- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: How to tell a junction from a directory?
A junction is less confusing than a roundabout for American friends visiting the UK.............
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
-
Zach
- Addict

- Posts: 1677
- Joined: Sun Dec 12, 2010 12:36 am
- Location: Somewhere in the midwest
- Contact:
Re: How to tell a junction from a directory?
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
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
Re: How to tell a junction from a directory?
Thanks! Looks like microsoft's attempt at recreating a symbolic link and failing badly! lol! When will microsoft learn. he he,...luis wrote:http://en.wikipedia.org/wiki/NTFS_junction_pointBlood wrote:What is a junction?
C provides the infinitely-abusable goto statement, and labels to branch to. Formally, the goto is never necessary, and in practice it is almost always easy to write code without it. We have not used goto in this book. -- K&R (2nd Ed.) : Page 65
Re: How to tell a junction from a directory?
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
-
IdeasVacuum
- Always Here

- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: How to tell a junction from a directory?
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.

