public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Finding junction points
@ 2011-02-07 18:04 Jeffrey J. Kosowsky
  2011-02-07 19:19 ` Cyrille Lefevre
  0 siblings, 1 reply; 6+ messages in thread
From: Jeffrey J. Kosowsky @ 2011-02-07 18:04 UTC (permalink / raw)
  To: cygwin

Is there any way to find (all) junction point using cygwin?
(if not possible in cygwin, can you point me to native win
functionality)
thanks

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Finding junction points
  2011-02-07 18:04 Finding junction points Jeffrey J. Kosowsky
@ 2011-02-07 19:19 ` Cyrille Lefevre
  2011-02-07 19:26   ` Jeffrey J. Kosowsky
  0 siblings, 1 reply; 6+ messages in thread
From: Cyrille Lefevre @ 2011-02-07 19:19 UTC (permalink / raw)
  To: cygwin


Le 07/02/2011 19:03, Jeffrey J. Kosowsky a écrit :
>
> Is there any way to find (all) junction point using cygwin?
> (if not possible in cygwin, can you point me to native win
> functionality)

how about the old dir one :-)

~ $ cmd /c dir /a:l
...
  R▒pertoire de C:\Users\Cyrille\Documents

17/12/2009  15:03    <JONCTION>     Cygwin [\??\C:\cygwin\home\Cyrille]
24/09/2007  21:37    <JONCTION>     Ma musique [C:\Users\Cyrille\Music]
28/09/2007  23:45    <JONCTION>     Mes contacts [C:\Documents and 
Settings\Cyrille\Contacts]
24/09/2007  21:37    <JONCTION>     Mes images [C:\Users\Cyrille\Pictures]
28/09/2007  23:44    <JONCTION>     Mes liens [C:\Documents and 
Settings\Cyrille\Favorites]
28/09/2007  23:43    <JONCTION>     Mes t▒l▒chargements [C:\Documents 
and Settings\Cyrille\Downloads]
24/09/2007  21:37    <JONCTION>     Mes vid▒os [C:\Users\Cyrille\Videos]

add /s for a recursive search

well, that(s funny :

/windows $ cmd /c dir /a:l /s
...
Le nom de r▒pertoire C:\windows\System32\config\systemprofile\Local 
Settings\Application Data\Application Data\Application Data\Application 
Data\Application Data\Application Data\Application Data\Application 
Data\Microsoft\Windows\GameExplorer\{0AE259F7-4756-4B2B-883C-B5B1D0A4D346} 
est trop long.
...

even windows commands fails one recursive junctions !

Regards,

Cyrille Lefevre
-- 
mailto:Cyrille.Lefevre-lists@laposte.net



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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Finding junction points
  2011-02-07 19:19 ` Cyrille Lefevre
@ 2011-02-07 19:26   ` Jeffrey J. Kosowsky
  2011-02-07 19:46     ` Cyrille Lefevre
  0 siblings, 1 reply; 6+ messages in thread
From: Jeffrey J. Kosowsky @ 2011-02-07 19:26 UTC (permalink / raw)
  To: Cyrille Lefevre; +Cc: cygwin

Cyrille Lefevre wrote at about 20:19:20 +0100 on Monday, February 7, 2011:
 > 
 > Le 07/02/2011 19:03, Jeffrey J. Kosowsky a écrit :
 > >
 > > Is there any way to find (all) junction point using cygwin?
 > > (if not possible in cygwin, can you point me to native win
 > > functionality)
 > 
 > how about the old dir one :-)
 > 
 > ~ $ cmd /c dir /a:l
 > ...
 >   R▒pertoire de C:\Users\Cyrille\Documents
 > 
 > 17/12/2009  15:03    <JONCTION>     Cygwin [\??\C:\cygwin\home\Cyrille]
 > 24/09/2007  21:37    <JONCTION>     Ma musique [C:\Users\Cyrille\Music]
 > 28/09/2007  23:45    <JONCTION>     Mes contacts [C:\Documents and 
 > Settings\Cyrille\Contacts]
 > 24/09/2007  21:37    <JONCTION>     Mes images [C:\Users\Cyrille\Pictures]
 > 28/09/2007  23:44    <JONCTION>     Mes liens [C:\Documents and 
 > Settings\Cyrille\Favorites]
 > 28/09/2007  23:43    <JONCTION>     Mes t▒l▒chargements [C:\Documents 
 > and Settings\Cyrille\Downloads]
 > 24/09/2007  21:37    <JONCTION>     Mes vid▒os [C:\Users\Cyrille\Videos]
 > 
 > add /s for a recursive search
 > 
 > well, that(s funny :
 > 
 > /windows $ cmd /c dir /a:l /s
 > ...
 > Le nom de r▒pertoire C:\windows\System32\config\systemprofile\Local 
 > Settings\Application Data\Application Data\Application Data\Application 
 > Data\Application Data\Application Data\Application Data\Application 
 > Data\Microsoft\Windows\GameExplorer\{0AE259F7-4756-4B2B-883C-B5B1D0A4D346} 
 > est trop long.
 > ...
 > 
 > even windows commands fails one recursive junctions !
 > 

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.


where each source and target are full pathnames.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Finding junction points
  2011-02-07 19:26   ` Jeffrey J. Kosowsky
@ 2011-02-07 19:46     ` Cyrille Lefevre
  2011-02-07 19:59       ` Jeffrey J. Kosowsky
  0 siblings, 1 reply; 6+ messages in thread
From: Cyrille Lefevre @ 2011-02-07 19:46 UTC (permalink / raw)
  Cc: cygwin


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}'

Regards,

Cyrille Lefevre
-- 
mailto:Cyrille.Lefevre-lists@laposte.net



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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Finding junction points
  2011-02-07 19:46     ` Cyrille Lefevre
@ 2011-02-07 19:59       ` Jeffrey J. Kosowsky
  2011-02-07 20:05         ` Jeffrey J. Kosowsky
  0 siblings, 1 reply; 6+ messages in thread
From: Jeffrey J. Kosowsky @ 2011-02-07 19:59 UTC (permalink / raw)
  To: Cyrille Lefevre; +Cc: cygwin

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:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Finding junction points
  2011-02-07 19:59       ` Jeffrey J. Kosowsky
@ 2011-02-07 20:05         ` Jeffrey J. Kosowsky
  0 siblings, 0 replies; 6+ messages in thread
From: Jeffrey J. Kosowsky @ 2011-02-07 20:05 UTC (permalink / raw)
  To: Jeffrey J. Kosowsky; +Cc: Cyrille Lefevre, cygwin

Jeffrey J. Kosowsky wrote at about 14:59:00 -0500 on Monday, February 7, 2011:
 > 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)
 > 	}
 > }

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-02-07 20:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-07 18:04 Finding junction points Jeffrey J. Kosowsky
2011-02-07 19:19 ` Cyrille Lefevre
2011-02-07 19:26   ` Jeffrey J. Kosowsky
2011-02-07 19:46     ` Cyrille Lefevre
2011-02-07 19:59       ` Jeffrey J. Kosowsky
2011-02-07 20:05         ` Jeffrey J. Kosowsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).