Rsync exclude & include?

hi
I have a few folders and a few files , for example
Directory A B C D E
Files 1 2 3 4 5

I want B directory and "2" File that does not sync
But other directories and file sync

What is the solution ?
Is there a way to sync time is under one minute?
os centos 6.8
thanks...

man rsync is an invaluable source of information. e.g. it says - on top of filter rules - :

Are A, B and so on on separate physical mountpoints? or different servers?
I am assuming there are A, B ... directories one place and then another set of A, B ... directories somewhere else. Maybe far away.

As a side note - if these directories and files change a lot rsync may not be able to complete everything in less than one minute, depending on topology. Hypothetically --- This means running rsync in asynchronous mode - start every minute whether or not the other job completed - may cause a backlog. In cases like that sometimes NFS is a better choice.

So please give us a complete picture.

1 Like

Thanks for replay
There are two serevers
192.168.10.242
192.168.10.243
that would be sync together
The command It does not work.

rsync -avzh --exclude=/var/www/html/B --include=/var/www/html/ user@192.168.10.243:/var/www/html

I want to all sync directory except B directory

When specifying exclude paths then should be anchored to the root of the transfer path like this:

rsync -avzh --exclude=/B /var/www/html/ user@192.168.10.243:/var/www/html

Note: if you used just B instead of /B it would exclude all directories named "B" even in other sub folders (eg /var/www/html/backup/Fri/B would also be excluded)

2 Likes

thank u very much for your answer my problem to be solve
but when i want to have same storage what way can i use for it i mean two storage sync together