2

I'm using

rsync . $HOST:$PATH --itemize-changes --verbose --human-readable --times --checksum --recursive --delete --delete-excluded --force --filter='dir-merge .rsync-filter'

and .rsync-filter looks like this:

exclude .gitinstructions
exclude .gitignore
exclude .rsync-filter
exclude .gitlab-ci.yml
exclude .git
exclude timestamp.txt
exclude var
exclude LICENSE.html
exclude LICENSE.txt
exclude LICENSE_AFL.txt
exclude RELEASE_NOTES.txt
exclude config.json

protect media/**/*

Although on the remote, the media folder is being deleted:

$ rsync . $SSH_HOST:$SSH_STAGEPATH --itemize-changes --verbose --human-readable --times --checksum --recursive --delete --delete-excluded --force --filter='dir-merge .rsync-filter' sending incremental file list .d..t...... ./ *deleting media/test *deleting media/

sent 680.12K bytes received 28.00K bytes 472.08K bytes/sec total size is 139.20M speedup is 196.58

Am I missing anything? I basically want all the "excluded files/dirs" to not be uploaded, but deleted on the remote, and the "protected files/dirs" to not be uploaded and not be deleted. I was sure I am following the correct syntax from the man page.

0

Could you confirm the problem persists when you put

protect media/**/*

at the top of your .rsync-filter ?
In your example, it is at the bottom of the filter.

From the rsync man page:

Note that if you are supplying your own filter rules, you may need to manually insert your own exclude/protect rule somewhere higher up in the list so that it has a high enough priority to be effective (e.g., if your rules specify a trailing inclusion/exclusion of oq*cq, the auto-added rule would never be reached).


  • awh, i can't believe i missed that. i'll try it later on when a have a good time to test it. thanks. – bitten Dec 2 '16 at 9:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.