Skip to content

Can't include specific files from excluded wildcard match (rsync: ordering of --exclude/--include) - Workaround exist #1420

@insubstudios

Description

@insubstudios

i'm trying to exclude most of my dotfiles and include a few specifically but it's not working.

i added /home/xin/.* to my excludes and to my includes:

  • 📁 /home/xin/.ssh
  • 📁 /home/xin/.fonts
  • 📄 /home/xin/.bashrc
  • 📄 /home/xin/.gitconfig
  • 📄 /home/xin/.gitignore

the folders are getting backed up but not the single files.

i checked the logs and the rsync command generated by BiT is putting the includes after the excludes. i copy/pasted it, moved the includes up, and ran it manually and it worked as expected.

Original rsync call from BIT logs (causing the problem)

from backintime log (line breaks added for clarity):

[I] rsync --recursive --times --devices --specials --hard-links --human-readable -s --links --perms --executability --group --owner --info=progress2 --no-inc-recursive --delete --delete-excluded -v -i --out-format=BACKINTIME: %i %n%L --link-dest=../../20230405-165753-308/backup --chmod=Du+wx
	--exclude=/media/xin/bigbox-6-A/xin
	--exclude=/home/xin/.local/share/backintime
	--exclude=.local/share/backintime/mnt
	
	--include=/home/xin/
	--include=/home/
	--include=/home/xin/.fonts/
	--include=/home/xin/.ssh/
	
	--exclude=.gvfs
	--exclude=.cache/*
	--exclude=.thumbnails*
	--exclude=.local/share/[Tt]rash*
	--exclude=*.backup*
	--exclude=*~
	--exclude=.dropbox*
	--exclude=/proc/*
	--exclude=/sys/*
	--exclude=/dev/*
	--exclude=/run/*
	--exclude=/etc/mtab
	--exclude=/var/cache/apt/archives/*.deb
	--exclude=lost+found/*
	--exclude=/tmp/*
	--exclude=/var/tmp/*
	--exclude=/var/backups/*
	--exclude=.Private
	--exclude=/home/xin/.*
	
	--include=/home/xin/**
	--include=/home/xin/.fonts/**
	--include=/home/xin/.ssh/**
	--include=/home/xin/.gitignore
	--include=/home/xin/.gitconfig
	--include=/home/xin/.bashrc
	
	--exclude=*
/ /media/xin/bigbox-6-A/xin/backintime/offish/xin/1/new_snapshot/backup

Expected rsync call modified order of include/exclude (solving the problem)

modified that works as expected:

rsync --recursive --times --devices --specials --hard-links --human-readable -s --links --perms --executability --group --owner --info=progress2 --no-inc-recursive --delete --delete-excluded -v -i --out-format=BACKINTIME: %i %n%L --link-dest=../../20230405-165753-308/backup --chmod=Du+wx
	--exclude=/media/xin/bigbox-6-A/xin
	--exclude=/home/xin/.local/share/backintime
	--exclude=.local/share/backintime/mnt
	
	--include=/home/xin/
	--include=/home/
	--include=/home/xin/.fonts/
	--include=/home/xin/.ssh/
	
	--include=/home/xin/.gitignore
	--include=/home/xin/.gitconfig
	--include=/home/xin/.bashrc
	
	--exclude=.gvfs
	--exclude=.cache/*
	--exclude=.thumbnails*
	--exclude=.local/share/[Tt]rash*
	--exclude=*.backup*
	--exclude=*~
	--exclude=.dropbox*
	--exclude=/proc/*
	--exclude=/sys/*
	--exclude=/dev/*
	--exclude=/run/*
	--exclude=/etc/mtab
	--exclude=/var/cache/apt/archives/*.deb
	--exclude=lost+found/*
	--exclude=/tmp/*
	--exclude=/var/tmp/*
	--exclude=/var/backups/*
	--exclude=.Private
	--exclude=/home/xin/.*
	
	--include=/home/xin/**
	--include=/home/xin/.fonts/**
	--include=/home/xin/.ssh/**
	
	--exclude=*
/ /media/xin/bigbox-6-A/xin/backintime/offish/xin/1/new_snapshot/backup

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugDiscussiondecision or consensus neededExternaldepends on others/upstream

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions