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

next in thread | previous in thread | raw e-mail | index | archive | help
At 1:24 PM -0400 9/9/10, Aryeh Friedman wrote:
>I want to make it so every file is a seperate symlink in dir2 if and
>only if it is a regular file (not a dir) in dir1... the reason is if
>the file is unchanged then use symlink but I can rm the symlink and
>replace it with a non-symlink:
>
>To show the problem I am attempting to solve:
>
>foo: (owned by fred)
>     arf:
>        ack
>
>in barney's account:
>
>ln -s ~foo/ foo
>rm foo/arf/ack    # Permissioin denied ... it should nuke the symlink
>and let me then do something like "touch foo/arf/ack
>
>Note there are over 500 files upto 5 dirs deep in the dir I want to
>symlink from.... the final application is our version control system
>(devel/aegis) keeps seperate repos for different source code projects
>(for obvious reasons) and we want to make it so in normal operation we
>can symlink tne source tree from one project into an other but if we
>want to make a local modificiation to the "foreign" source tree all we
>have do is (sorry for the aegis commands but I think the idea is
>clear):

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.

I don't know if X11 still has these commands (I haven't
installed X11 in at least 10 years), but I have my own
versions of them.  Let me know if you can't find them, and
I'll send you copies of my scripts.

(actually, I'm not 100% sure I got these from X11.  But I got
them from somewhere in the mid-1990's)

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