I want a simple and working (multiple) exclude
option inside my rsync
command. Lets say i will exclude a file
and a directory
:
What i did is:
rsync -avz --exclude="/var/www/html/test.txt" --exclude="/var/www/html/images/" /var/www/html [email protected]:/var/www
or
rsync -avz --exclude=/var/www/html/test.txt --exclude=/var/www/html/images/ /var/www/html [email protected]:/var/www
or
rsync -avz --exclude /var/www/html/test.txt --exclude /var/www/html/images/ /var/www/html [email protected]:/var/www
..
But however, the --exclude
is NOT WORKING!
Everything is going out!
Note: I also don't want to use external exclusion list file. Just want all in one simple command.
i got it solved by myself after i've learned and tested many times. The real problem was the understandable (for me) --exclude
option usage format.
I don't know how others are doing but i just found out that:
Because i was using the path(s) like: --exclude /var/www/html/text.txt
which caused the thing DOES NOT work. So i used like:
--exclude text.txt --exclude images/
.. and it WORKS!