I'm trying to set up an rsync that excludes all .* files except for .htaccess but unfortunately, this doesn't work:rsync -avP --exclude=.* --include=./.htaccess ./. user@server:/dirIs it possible to somehow exclude general exclude rules?
How to include files that are excluded in an rsync
rsync
The first matching rule applies, so include .htaccess before excluding .*.rsync -avP --include=.htaccess --exclude=.* . user@server:/dirThis copies .htaccess at every level. I don't know what you intended with ./.htaccess; if you want to match a file at the root of the copy only, start the pattern with a /. If you only want the root .htaccess, you can't just use --include='/.htaccess' --exclude='.*', because the non-rooted rule actually takes precedence here, you need to do something more complicated:rsync -avP --exclude='/*/**/.htaccess' --include='.htaccess' --exclude=.* . user@server:/dirFurther reading: basic principles for rsync filters.