Exclude directories from chown

There's been times when I needed to recursively change ownership of files in a directory but leave certain files alone (e.g. snapshot folders). Came across a highly useful post from Posteet on how to do it.

In my case, I needed to exclude directories owned by root and the .snapshot directory. So
# find . -xdev -name .snapshot -or -user root -prune -print | xargs chown <user>:<group>

Comments

Popular posts from this blog

Flash game: Cargo Bridge

Copying Sony recovery partition to new harddisk