Does the rsync –archive option override the –exclude option?

I am running an rsync -avz command which excludes a large 32GB file by using --exclude=/file/path and no matter what I do rsync transfers the file.

I understand that logically the --archive option means mirror everything, but the examination of the -rlptgoD options the --archive option is equivalent to doesn’t seem to explicitly override the --exclude option

--archive, -a            archive mode is -rlptgoD (no -A,-X,-U,-N,-H)


--recursive, -r          recurse into directories    
--links, -l              copy symlinks as symlinks
--times, -t              preserve modification times
--perms, -p              preserve permissions
--group, -g              preserve group
--owner, -o              preserve owner (super-user only)
-D                       same as --devices --specials
--devices                preserve device files (super-user only)
--specials               preserve special files
Asked By: vfclists

||

The -a/--archive option doesn’t override --exclude. In my own rsync commands I’ve found that when my --exclude doesn’t seem to work it’s always because rsync sees the path to the file(s) as different from the path I put in my --exclude argument.

I’ve found that adding the --list-only after my other options will show rsync’s path to the file and usually makes the discrepancy visible.

Answered By: Sotto Voce
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.