This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Finding junction points

Cyrille Lefevre wrote at about 20:46:10 +0100 on Monday, February 7, 2011:
 > Le 07/02/2011 20:25, Jeffrey J. Kosowsky a écrit :
 > > Yes - that is one of my two problems:
 > > 1. It gets messed up on loops created by its own junctions
 > > 2. The format of the output is a bit difficult to parse since you have
 > >     to go back up to see what directory you are in.
 > >
 > > Ideally, I would like to have the output in 2-columns like:
 > > source1   target1
 > > source 2  target2
 > > etc.
 > something like this ?
 > cmd /c dir /a:l /n | awk '/^ /{$1=$2="";sub(/^ 
 > +/,"");d=$0;next}/JONCTION/{sub(/.*<JONCTION> +/,"");sub(/\[/, "-> 
 > ");sub(/\]$/, ""); print d "\\" $0}'

Yes that is helpful (though at least in English one needs to use
JUNCTION rather than JONCTION :) and I added >/dev/null to capture the
"too long" lines.

However, it still has the problem we both identified of capturing
many duplicates and loops (until one gets them too long).

For example,
C:\Documents and Settings\Default User ->C:\Users\Default
is a duplicate of:
C:\Users\Default User ->C:\Users\Default

To do this right, one would want to stop the recursion as soon as a
junction is found since recursing down the junction will by definition
create duplicates.

The recursion one wants is something like (in pseudo code)

find_junctions(dir) {
	for 'each' entry in dir {
		if entry is a junction, then print junction
		if 'entry' is a directory, find_junction(entry)

Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]