From owner-freebsd-questions@FreeBSD.ORG Thu Sep 9 18:13:21 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 9E1B610656C9 for ; Thu, 9 Sep 2010 18:13:21 +0000 (UTC) (envelope-from jrisom@gmail.com) Received: from mail-pv0-f182.google.com (mail-pv0-f182.google.com [74.125.83.182]) by mx1.freebsd.org (Postfix) with ESMTP id 6EEB58FC0A for ; Thu, 9 Sep 2010 18:13:21 +0000 (UTC) Received: by pvc21 with SMTP id 21so87264pvc.13 for ; Thu, 09 Sep 2010 11:13:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=D1f02oH48/9chH+RLQTV0HG9CKucnfbtnpdx3DwWr88=; b=TKFpa+Oq6Q2tmjgMr96j5+1Qwvj2BSE3JJ2mxFdt4HeTgmk2e5MQ58oG78FaqShrws 9KBU9Y8doaflhrnhJC68/C7yD9DMjX3hhYlm6/3p2Wg6Nt95U4Z1Stf68+6n05+fWr6v ngu8+Npz54Xh0WQilQBsGvqi3ztEqRb5xjj7E= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=lk6qHPbO4kYLi27VhTp8nEVURAm61H4sZViVKhfq2RoFLr7BdRvtj1U5uEFEpvfQTb FT/VKmBPIRRurLBRMdQxM9uErOavZsTg8PXgoU5U5tX6oBNjDG/w6LMeYUbTYhAoWRuB 62XMLJvGg9m1mcd+DQosOAzLf+x3pRa+iRaeA= Received: by 10.142.241.17 with SMTP id o17mr204907wfh.240.1284056000577; Thu, 09 Sep 2010 11:13:20 -0700 (PDT) Received: from [192.168.1.3] (c-24-14-170-47.hsd1.il.comcast.net [24.14.170.47]) by mx.google.com with ESMTPS id g31sm1381068ibh.16.2010.09.09.11.13.18 (version=SSLv3 cipher=RC4-MD5); Thu, 09 Sep 2010 11:13:19 -0700 (PDT) Message-ID: <4C8923BC.4080209@gmail.com> Date: Thu, 09 Sep 2010 13:13:16 -0500 From: Joshua Isom User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.9) Gecko/20100825 Thunderbird/3.1.3 MIME-Version: 1.0 To: freebsd-questions@freebsd.org References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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:13:21 -0000 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) > 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 This should give you at least a good start: find foo/ \( -type d -exec mkdir -p copy/'{}' \; \) -o \( -type f -exec ln -s '{}' copy/'{}' \; \) That'll copy directory foo into copy/foo and the rest is fine. You'll have to tweak the rest as you need but it'll get you started.