Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Sep 2010 20:23:09 -0400
From:      Garance A Drosehn <gad@FreeBSD.org>
To:        Chad Perrin <perrin@apotheon.com>, FreeBSD Mailing List <freebsd-questions@FreeBSD.org>
Cc:        Aryeh Friedman <aryeh.friedman@gmail.com>
Subject:   Re: how to recursively symlink every file in a dir
Message-ID:  <p06240801c8af262f19ea@[128.113.124.121]>
In-Reply-To: <20100909205424.GA58499@guilt.hydra>
References:  <AANLkTimR9QehTjUrm%2B0CqRVAx=QHkgcfpygrJJfkhbmp@mail.gmail.com> <p06240800c8aef2c50d17@[128.113.124.121]> <20100909205424.GA58499@guilt.hydra>

next in thread | previous in thread | raw e-mail | index | archive | help
At 2:54 PM -0600 9/9/10, Chad Perrin wrote:
>On Thu, Sep 09, 2010 at 04:28:59PM -0400, Garance A Drosehn wrote:
>>
>>  I believe early X11-distributions had a script called "lndir"
>>  would pretty much do exactly what you want here.  And then
>>  there was a companion command called "breakln" which would
>>  remove the symlink and make a copy of the original file to
>>  replace it.
>
>lndir is in ports:
>
>     > pkgsearch lndir
>     /usr/ports/devel/lndir
>
>I'm not so sure about a "breakln" being anywhere accessible,
>other than whatever tools you have handy.

>I'd like to see what you have, even if the OP doesn't need
>them.  Are they of your own making, or copied from somewhere?

It looks like my 'lndir' script started out as a copy of a
script named 'lndir.sh' that the XConsortium had in Oct 1988.
Over the years I added a number of features to it.  Looking
at the 'lndir' which is installed by the port, it seems to
have added some of those same features, but my script writes
out it's progress in a nicer format (IMO).

Given that the port is written in C and much more recent, I
suspect it is the right way to go.  For large directories it
is much faster than my script.  I should check to see how
much work it'd be to add my formatting to the C version.

The 'breakln' script might be something written here at RPI.
Looks like the last change to it was done in 1993.  It is
pretty simple:


#!/bin/sh
#
#  All the arguments are turned into copies of themselves,
#  and write access is granted to the user.    This is good
#  for making exceptions to trees built with lndir.
#
if [ $# = 0 ]; then
   echo "Usage: $0 files..."
   exit
fi

for f in $* ; do
   mv $f $f.tmpln
   cp -p $f.tmpln $f
   rm $f.tmpln
   chmod u+w $f
done

-- 
Garance Alistair Drosehn     =               drosehn@rpi.edu
Senior Systems Programmer               or   gad@FreeBSD.org
Rensselaer Polytechnic Institute;             Troy, NY;  USA



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?p06240801c8af262f19ea>