rsync - How to exclude one .htaccess but not all of them

Posted by Cory Gagliardi on Server Fault See other posts from Server Fault or by Cory Gagliardi
Published on 2012-10-21T14:29:37Z Indexed on 2012/10/21 17:03 UTC
Read the original article Hit count: 274

Filed under:

I have an rsync command for copying my files from dev to production. I don't want to copy the .htaccess file that's in the root of the HTML directory but, I do want to copy the few .htaccess files that are in its sub directories.

I'm using the argument --exclude .htaccess which is stopping all of the files from getting copied. The other arguments I'm including are -a --recursive --times --perms. Is it possible to configure rsync to do this?

Edit: Here is my full command:

rsync -a --recursive --times --perms \
    --exclude prop_images --exclude tracking --exclude vtours \
    --exclude .htaccess --exclude .htaccess_backup --exclude "*~" \ 
    /home/user/dev_html/* /home/user/public_html/

© Server Fault or respective owner

Related posts about rsync