# find chown -R



## missinglynk (Aug 16, 2007)

hello,

so i've been trying to change ownership of all directories in a directory owned by many people to one group. issue is there are dozens of linked directories which i do not what to chown on. so i've been trying to find an easy way to do this and have gotten this far:
# find . ! -user [user] -prune -exec chown -h [user] {} \;
for my effort i get:
find: No match.
now i've changed user to match file owners and/or new owners but still no dice...
can anyone see what the heck i'm missing here?

~lynk


----------



## missinglynk (Aug 16, 2007)

welp i've got it working for single parent dir. now -R :s


----------



## mike.lamb (Aug 16, 2007)

just to clarify this is your example filesystem...
+topdir
-topdir
...-middir
......+subdir
......+subdir
......+subdir 
...-middir
......+subdir
......+subdir
...+middir
+topdir




What you are asking is to be able to change ownership of all the middir directories without affecting the subdir directories?

If this is so just use

```
chown user:group *
```
 whilst in the topdir directory that contains the affected filesystem.

Hope this helps


----------



## missinglynk (Aug 16, 2007)

Hi mike.lamb,

Yeah that's just what I needed to do, but we're talking gigs of data and hundreds of dirs. 
I did what you suggested on the dirs without links, chown -R dir user. 
For the ones with links to god knows where I. 
# find . ! old_user -prune -exec chown -R new_user {} \;
It took longer then I wanted but kept ownship in place where I wanted too.
...Brute Force is in, oh boy, brute force is in... 
Thank you for helping me sort this out.
~lynk


----------

