[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: chown fails to ignore symbolic links during recursive directory tran
From: |
Bob Proulx |
Subject: |
Re: chown fails to ignore symbolic links during recursive directory transversals |
Date: |
Wed, 9 Mar 2005 10:55:32 -0700 |
User-agent: |
Mutt/1.5.6+20040907i |
Mark Brand wrote:
> Moreover, there doesn't seem to be any way of invoking chown so that it
> operates recursively on a directory tree but ignores (doesn't follow)
> symbolic links.
Personally I would use find/xargs. Like this:
> haydn:~ # mkdir sandbox
> haydn:~ # cd sandbox/
> haydn:~/sandbox # mkdir -p a/aa/aaa
> haydn:~/sandbox # touch foo
> haydn:~/sandbox # mkdir b
> haydn:~/sandbox # cd a/aa/aaa/
> haydn:~/sandbox/a/aa/aaa # ln -s ../../../foo foo
> haydn:~/sandbox/a/aa/aaa # ln -s ../../../b b
> haydn:~/sandbox/a/aa/aaa # cd ../../..
> haydn:~/sandbox # ls -l
> total 2
> drwxr-xr-x 4 root root 120 Mar 9 10:03 .
> drwx------ 37 root root 2304 Mar 9 10:02 ..
> drwxr-xr-x 3 root root 72 Mar 9 10:03 a
> drwxr-xr-x 2 root root 48 Mar 9 10:03 b
> -rw-r--r-- 1 root root 0 Mar 9 10:03 foo
> haydn:~/sandbox # chown -R nobody:users a
find a -print0 | xargs -r0 chown nobody:users
Does that work as you desire?
Bob