delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/02/07/15:05:16

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=4.7 required=5.0 tests=AWL,BAYES_00,BOTNET,RCVD_IN_DNSWL_NONE
X-Spam-Check-By: sourceware.org
From: "Jeffrey J. Kosowsky" <cygwin AT kosowsky DOT org>
MIME-version: 1.0
Message-id: <19792.20578.507362.720966@consult.pretender>
Date: Mon, 07 Feb 2011 15:04:50 -0500
To: "Jeffrey J. Kosowsky" <cygwin AT kosowsky DOT org>
Cc: Cyrille Lefevre <cyrille DOT lefevre-lists AT laposte DOT net>, cygwin AT cygwin DOT com
Subject: Re: Finding junction points
In-reply-to: <19792.20228.470412.230374@consult.pretender>
References: <19792 DOT 13316 DOT 462354 DOT 112225 AT consult DOT pretender> <4D5045B8 DOT 3080209 AT laposte DOT net> <19792 DOT 18244 DOT 175041 DOT 754011 AT consult DOT pretender> <4D504C02 DOT 9090506 AT laposte DOT net> <19792 DOT 20228 DOT 470412 DOT 230374 AT consult DOT pretender>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Jeffrey J. Kosowsky wrote at about 14:59:00 -0500 on Monday, February 7, 20=
11:
 > Cyrille Lefevre wrote at about 20:46:10 +0100 on Monday, February 7, 201=
1:
 >  >=20
 >  > Le 07/02/2011 20:25, Jeffrey J. Kosowsky a =E9crit :
 >  > > 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 h=
ave
 >  > >     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.
 >  >=20
 >  > something like this ?
 >  >=20
 >  > cmd /c dir /a:l /n | awk '/^ /{$1=3D$2=3D"";sub(/^=20
 >  > +/,"");d=3D$0;next}/JONCTION/{sub(/.*<JONCTION> +/,"");sub(/\[/, "->=
=20
 >  > ");sub(/\]$/, ""); print d "\\" $0}'
 >  >=20
 >=20
 > 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.
 >=20
 > However, it still has the problem we both identified of capturing
 > many duplicates and loops (until one gets them too long).
 >=20
 > For example,
 > C:\Documents and Settings\Default User ->C:\Users\Default
 > is a duplicate of:
 > C:\Users\Default User ->C:\Users\Default
 >=20
 > 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.
 >=20
 > The recursion one wants is something like (in pseudo code)
 >=20
 > find_junctions(dir) {
 > 	for 'each' entry in dir {
 > 		if entry is a junction, then print junction
 > 		if 'entry' is a directory, find_junction(entry)
 > 	}
 > }

I realized that your code didn't have the '/s' recursion flag so
strictly speaking it wasn't susceptible to the looping problem.

But, it seems like what I really maybe need here is some help from
somebody fluent in PowerShell since I imagine that combining Windows
'dir' with 'bash' recursion and calls to things like 'awk' to parse
the results will be painfully slow. But maybe native PowerShell will
allow closer access to the underlying filesystem functions.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019