From owner-freebsd-questions@FreeBSD.ORG Thu Sep 9 20:29:28 2010 Return-Path: Delivered-To: freebsd-questions@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36F4510656DE for ; Thu, 9 Sep 2010 20:29:28 +0000 (UTC) (envelope-from gad@FreeBSD.org) Received: from smtp8.server.rpi.edu (smtp8.server.rpi.edu [128.113.2.228]) by mx1.freebsd.org (Postfix) with ESMTP id ACB2B8FC19 for ; Thu, 9 Sep 2010 20:29:27 +0000 (UTC) Received: from [128.113.124.121] (gilead.netel.rpi.edu [128.113.124.121]) by smtp8.server.rpi.edu (8.13.1/8.13.1) with ESMTP id o89KT0At002341; Thu, 9 Sep 2010 16:29:23 -0400 Mime-Version: 1.0 Message-Id: In-Reply-To: References: Date: Thu, 9 Sep 2010 16:28:59 -0400 To: Aryeh Friedman , FreeBSD Mailing List From: Garance A Drosehn Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-Bayes-Prob: 0.0001 (Score 0) X-RPI-SA-Score: 0.10 () [Hold at 15.00] COMBINED_FROM X-CanItPRO-Stream: outgoing X-Canit-Stats-ID: Bayes signature not available X-Scanned-By: CanIt (www . roaringpenguin . com) on 128.113.2.228 Cc: Subject: Re: how to recursively symlink every file in a dir X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 20:29:28 -0000 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