BackupPC-users

Re: [BackupPC-users] BackupPC and Windows junction points

2011-02-07 20:35:17
Subject: Re: [BackupPC-users] BackupPC and Windows junction points
From: "Jeffrey J. Kosowsky" <backuppc AT kosowsky DOT org>
To: "General list for user discussion, questions and support" <backuppc-users AT lists.sourceforge DOT net>
Date: Mon, 07 Feb 2011 20:32:50 -0500
John Rouillard wrote at about 23:44:48 +0000 on Monday, February 7, 2011:
 > On Mon, Feb 07, 2011 at 01:56:08PM -0600, Michael Stowe wrote:
 > > > On a side note, I *am* looking for a good way to cleanly list all the
 > > junction points so that I can periodically catalog them for potential
 > > future restore.
 > > >
 > > > Note I tried "dir /aL /s" but it doesn't give a very clean listing plus
 > > it seems to itself get hung up on junction loops. So, is there any good
 > > code (either cmd.exe, powershell, or cgywin) to find all junction points
 > > and list them in a simple 2-column like list
 > > > consisting of the "source" and the "target" (note standard cygwin 'find'
 > > or 'ls' won't help since it doesn't distinguish between
 > > > symlinks and junction points)
 > > 
 > > My first suggestion is what you've already tried:  "dir /aL"  The Windows
 > > command shell behaves quite differently than POSIX, so (for example)
 > > deleting a symlink to a directory in Windows actually deletes the
 > > *contents* not the symlink itself.  (Instead, you use rmdir to delete the
 > > symlink.  Yeesh.)
 > > 
 > > I'm not aware of a tool that gets past the looping issues, or even that
 > > has better output than dir (this doesn't mean they don't exist.)
 > 
 > junction.exe from sysinternals comes to mind as another junction
 > detection/creation tool. Not sure if it handles loops properly or not.

Unfortunately junction.exe also gets caught up in loops (due to
following junction points).


I don't understand why Microsoft can't do recursion 101.
As in:

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

How hard would that be?

I don't know *anything* about PowerShell, but is that something that
would be easy or even possible to write in PowerShell?

(I could do it in bash with calls to junction.exe or dir.exe but I am
concerned that the speed would suffer if I had to call a function like
junction on *every* single directory entry recursively)

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/