From owner-freebsd-questions@FreeBSD.ORG Thu Sep 9 18:01:53 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 D1F7A10656BF for ; Thu, 9 Sep 2010 18:01:53 +0000 (UTC) (envelope-from freebsd@qeng-ho.org) Received: from blue.qeng-ho.org (blue.qeng-ho.org [217.155.128.241]) by mx1.freebsd.org (Postfix) with ESMTP id 60AED8FC0C for ; Thu, 9 Sep 2010 18:01:53 +0000 (UTC) Received: from fileserver.home.qeng-ho.org (localhost [127.0.0.1]) by fileserver.home.qeng-ho.org (8.14.3/8.14.3) with ESMTP id o89I1qRB069855; Thu, 9 Sep 2010 19:01:52 +0100 (BST) (envelope-from freebsd@qeng-ho.org) Message-ID: <4C892110.9050104@qeng-ho.org> Date: Thu, 09 Sep 2010 19:01:52 +0100 From: Arthur Chance User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.1.11) Gecko/20100727 Thunderbird/3.0.6 MIME-Version: 1.0 To: Aryeh Friedman References: <4C891E66.3010405@qeng-ho.org> In-Reply-To: <4C891E66.3010405@qeng-ho.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: FreeBSD Mailing List 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:01:53 -0000 On 09/09/10 18:50, Arthur Chance wrote: > On 09/09/10 18:24, 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: > > cpio -pdl Ack! Too quick to answer. That hard links, not symlinks. (Useful in its own way though.) cd $SRCDIR; find . -type d | cpio -pd $DESTDIR will create the directory structure. Linking the files will have to be left as an exercise for the reader as I have to go out. I'd use find for the job, but I'm sure someone will come up with some Perl.