Date: Thu, 9 Sep 2010 14:25:41 -0400 From: Aryeh Friedman <aryeh.friedman@gmail.com> To: Joshua Isom <jrisom@gmail.com> Cc: freebsd-questions@freebsd.org Subject: Re: how to recursively symlink every file in a dir Message-ID: <AANLkTinQXrzLSeQzLcG0rqecz1YyrNWH-_4G_LBHRDF2@mail.gmail.com> In-Reply-To: <4C8923BC.4080209@gmail.com> References: <AANLkTimR9QehTjUrm%2B0CqRVAx=QHkgcfpygrJJfkhbmp@mail.gmail.com> <4C8923BC.4080209@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <jrisom@gmail.com> 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)
>> 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.
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTinQXrzLSeQzLcG0rqecz1YyrNWH-_4G_LBHRDF2>
