URGENT: Rsync command help needed

Anyone knows how to use rsync command in UNIX to exclude files/directories with specific groups?
I am trying to rsync a lot of files from one machine to another but I want to exclude some files/directories which belong to a specific set of groups

What do you mean by specific groups? can you just include the path of what you want to exclude with --exclude option?

For example:
dlxcq2028> l
total 20
drwxr-x— 1 kedar grp1 9456 Jun 15 09:36 scripts
drwxr-x— 2 kedar grp2 4096 Jun 15 09:39 bin
drwxr-x— 2 kedar grp3 4096 Jun 15 09:36 sample

I want to rsync these files but if the directory belongs to grp2 then do not rsync that. how do i do that with --exclude?

not sure if there is a straightforward command. Maybe you can use find to export a list filenames that belongs to grp2 into a text file and used --exclude-from to read from that text file.

Just an idea, not sure if it’ll work

Thanks, i will try out

You are absolutely right. This would be the way to accomplish this. Use

find yourpath -group grp2 > exclude-list

then use the rsync option --exclude-from exclude-list

It worked, thanks guys !!

What about running your rsync command with a user that only has permissions to those groups? If you are wanting to restrict by permissions, why not use permissions to do so?