On Saturday 24 July 2010 02:18 AM, steve wrote:
find /path/to/dir -user user1 -o -group user2 -not -user user3
this above command with find all files owner by user1 or group owned by user2 but not owned by user3. Because ...
-user matches the owner of the file -group matches the group owner of the file -o is the 'or' operator -not is the 'not' operator
The info pages (I personally prefer using 'pinfo' to browse the info pages) for find are pretty nicely organized. Take a look.
Thanks to all who responded. I had completely overlooked the operator part in man pages. The -not -user uname works just fantastic for my job. The options are fantastic.
What I am doing is that users belonging to the group that owns a folder get write permissions to it but after 10 minutes, the file and sub dir ownership changes to the one user who has write permissions and others from the group get read only with sticky bits and SGID depending on file or dir. Now the data is read only. It is an imitation of the 'paste but not delete' option in NTFS partitions. The find command looks only for files/dirs that are not owned by the main user and changes ownership and permissions accordingly.