Simple RSync EXCLUDE option?

I need a simple and working (several) excludeoption inside my team rsync. Suppose I exclude a fileand a directory:

  • /var/www/html/test.txt
  • / var / www / html / image /

What I've done:

rsync -avz --exclude="/var/www/html/test.txt" --exclude="/var/www/html/images/" /var/www/html root@xx.xx.xx.xx:/var/www

or

rsync -avz --exclude=/var/www/html/test.txt --exclude=/var/www/html/images/ /var/www/html root@xx.xx.xx.xx:/var/www

or

rsync -avz --exclude /var/www/html/test.txt --exclude /var/www/html/images/ /var/www/html root@xx.xx.xx.xx:/var/www

..

But, however, --excludeDOES NOT WORK!
Everything is coming out!

  • How to do this in this simple format, please?

Note. I also do not want to use an external exception list. I just want everything in one simple team.

+5
source share
2 answers

I decided to solve it after I found out and checked it many times. The real problem was the understandable (for me) usage format --exclude.

I don’t know how others do it, but I just found out that:

  • "- " !

(), : --exclude /var/www/html/text.txt, - . :

--exclude text.txt --exclude images/

.. !

+12

--exclude={text.txt,images/}.

  • , rsync exclude ( include), /, , /var/www/html!!, , /text.txt, , @ .
+5

All Articles