Im trying to rsync all the .PHP and .HTML files from any directory inside of /home/    .  However in /home/site2/public_html/cache_old/  there are .html files that i do not want to include in the sync (thus i want to exclude that directory and any of its sub-directories)Here is the best rsync command i can come up with (after lots of testing and failures):rsync -avv /home/ /ssd/rsyncPHPsFORmtree/ --include '*/' --include '*.html' --include '*.php' --exclude /site2/public_html/cache_old/* --exclude '*'Im convinced that my rsync command is not formatted properly based upon this output from when rsync is running:[sender] showing file site2/public_html/cache_old/total_pages/s/e/a/r/c/page99.html because of pattern *.html[sender] showing file site2/public_html/cache_old/total_pages/s/e/a/r/c/Page4.html because of pattern *.html[sender] showing file site2/public_html/cache_old/total_pages/s/e/a/r/c/searchHe107.html because of pattern *.html[sender] showing file site2/public_html/cache_old/total_pages/s/e/a/r/c/page18.html because of pattern *.htmlThanks
rsync exclude directory not working, when also scanning for only *.php files
linux;centos;rsync;synchronization
rsync -avv /home/ /ssd/rsyncPHPsFORmtree/ --exclude '/site2/public_html/cache_old/' --include '*.html' --include '*.php' --include '*/' --exclude '*'  This should do it.The order of the filers is important. The 1st matching rule applies. So you exclude the folder 1st, then include the files you want, then include directories that weren't previously excluded, then exclude everything else. 