From owner-freebsd-questions@FreeBSD.ORG Thu Sep 9 18:25:42 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 0FE7610656C8 for ; Thu, 9 Sep 2010 18:25:42 +0000 (UTC) (envelope-from aryeh.friedman@gmail.com) Received: from mail-pz0-f54.google.com (mail-pz0-f54.google.com [209.85.210.54]) by mx1.freebsd.org (Postfix) with ESMTP id D86A58FC12 for ; Thu, 9 Sep 2010 18:25:41 +0000 (UTC) Received: by pzk7 with SMTP id 7so724675pzk.13 for ; Thu, 09 Sep 2010 11:25:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=HL14xcEvDTbTGZIG07D4/uWLJhhJXisJKtPYLsGS3Jw=; b=NOQsVmNAvpCZC3DKnnQ5RKCqgcaaTbiuSaX0lB3khAZojeQoMCKmiF6wfKTlgptSHF l4p8EkWpqwxCyTBPdsy/KAd2KpvJLTjeekt4hjIzDqbmDSHR+M5e8yjoTJXNfHqvdBIh kN/9ueHNdzSaARUdUH5WZyRuyaXSEGke24Lak= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=wFY/5GpJYT9K+6+D/9ABWwEn/DZ9PQ5LnBEtlr6oq35RwGkobEKE5fs3RVM3mkxFKW 7iiidUqt0AMZSOLnWsyktoWNfipBkYWovkwGErNi1OAP72cN8ehTLaSz5s6ndGZui0WS qMRwb8BEeuA7DjfnqtL61jhRYDfdHHBT97QvY= MIME-Version: 1.0 Received: by 10.142.231.4 with SMTP id d4mr170198wfh.222.1284056741255; Thu, 09 Sep 2010 11:25:41 -0700 (PDT) Received: by 10.231.184.223 with HTTP; Thu, 9 Sep 2010 11:25:41 -0700 (PDT) In-Reply-To: <4C8923BC.4080209@gmail.com> References: <4C8923BC.4080209@gmail.com> Date: Thu, 9 Sep 2010 14:25:41 -0400 Message-ID: From: Aryeh Friedman To: Joshua Isom Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-questions@freebsd.org 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 18:25:42 -0000 After playing around here is what I came up with (cpio -l never did the links right): #!/bin/tcsh foreach i ( `find ~aegis/fnre/baseline/src/ -type d | grep -v src/build | cut -f6- -d'/'` ) mkdir $i end foreach i ( `find ~aegis/fnre/baseline/src/ -type f -name '*.java' | grep -v src/build | cut -f6- -d'/'` ) ln -s ~aegis/fnre/baseline/$i $i end On Thu, Sep 9, 2010 at 2:13 PM, Joshua Isom wrote: > On 9/9/2010 12:24 PM, 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) >> =A0 =A0 arf: >> =A0 =A0 =A0 =A0ack >> >> in barney's account: >> >> ln -s ~foo/ foo >> rm foo/arf/ack =A0 =A0# Permissioin denied ... it should nuke the symlin= k >> and let me then do something like "touch foo/arf/ack > > This should give you at least a good start: > > find foo/ \( -type d -exec mkdir -p copy/'{}' \; \) -o \( -type f -exec l= n > -s '{}' copy/'{}' \; \) > > That'll copy directory foo into copy/foo and the rest is fine. =A0You'll = have > to tweak the rest as you need but it'll get you started. > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.o= rg" >