From owner-freebsd-questions@FreeBSD.ORG Fri Sep 10 00:23:59 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 521261065694 for ; Fri, 10 Sep 2010 00:23:59 +0000 (UTC) (envelope-from gad@FreeBSD.org) Received: from smtp7.server.rpi.edu (smtp7.server.rpi.edu [128.113.2.227]) by mx1.freebsd.org (Postfix) with ESMTP id 180588FC14 for ; Fri, 10 Sep 2010 00:23:58 +0000 (UTC) Received: from [128.113.124.121] (gilead.netel.rpi.edu [128.113.124.121]) by smtp7.server.rpi.edu (8.13.1/8.13.1) with ESMTP id o8A0NABt027493; Thu, 9 Sep 2010 20:23:32 -0400 Mime-Version: 1.0 Message-Id: In-Reply-To: <20100909205424.GA58499@guilt.hydra> References: <20100909205424.GA58499@guilt.hydra> Date: Thu, 9 Sep 2010 20:23:09 -0400 To: Chad Perrin , 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.227 Cc: Aryeh Friedman 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: Fri, 10 Sep 2010 00:23:59 -0000 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