0

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
8
  • 1
    If it did, it'd be largely useless (I'm talking about both options here). Is there anything in the path that might cause it to be interpreted as pattern that doesn't match the actual path?
    – muru
    Feb 2 at 13:10
  • 1
    my point is that even explicit filenames can have characters that may be interpreted as something more.
    – muru
    Feb 2 at 13:39
  • 1
    No, -a/--archive does not override --exclude=path. In my rsync commands, when my --exclude doesn't seem to work, it's always because rsync views the path to the file as different from the path in my --exclude option. Adding --list-only after the other options often shows this difference.
    – Sotto Voce
    Feb 2 at 13:56
  • 1
    The file/path names for the --include and --exclude options are not necessarily relative to the source. They can start with / to anchor them to the source, or omit it to match at any point. Your example of path/file for a source directory of /src could match /src/this/is/my/path/file or /src/path/file or any other combination as long as it contains path/file Feb 3 at 18:07
  • 1
    @vfclists yes exactly Feb 5 at 13:36

1 Answer 1

3

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .