Rsync Minimalist: --include only does "add_exclude"

John Van Essen vanes002 at umn.edu
Wed Jan 19 11:30:00 GMT 2005


On Tue, 18 Jan 2005, Mike Todd <Mike at toddco.net> wrote:
>
> Why does this not include?  I have tried many variations including
> adding an exclude command.
> 
> Includes.txt:
> + //aBackup/*
> + //apic/*
> - /*

As Wayne pointed out, you are not matching anything by those names
in the rsync source directory, which is *not necesarily* the root
directory.  You don't need double slashes, btw.

> rsync --verbose --progress --stats -vv --recursive -e "ssh -p 2423"
> --include-from=includes.txt rsynchost:

Thanks for including the actual command this time.  It helps a lot.

Your source directory is your home directory on "rsynchost:".
This is *not* the root directory on the source system, which is
apparently where the aBackup directory is located.

Include/exclude paths with leading slashes are still relative to the
source/target directories - they are not absolute filesystem paths.
So /aBackup/ refers to an aBackup subdirectory in your home directory.

Also - you don't specify a target - so rsync will just give you a
listing of file information (like ls -l).

[ snip ]
> excluding directory .kde because of pattern /*
> excluding file .emacs because of pattern /*
> excluding file .bash_logout because of pattern /*
> excluding file .bash_profile because of pattern /*
> excluding file .bashrc because of pattern /*
> excluding file .gtkrc because of pattern /*
> excluding file .bash_history because of pattern /*
> excluding file .viminfo because of pattern /*

Those are all from your home directory, no?  Nothing matches
your include-from patterns, so you only get the home directory.

> received 1 names
> done
> drwxr-xr-x        4096 2005/01/16  .

That is the "ls -l" output from rsync for the source directory.
That is the only output since everything else was excluded.

[ snip ]

> C:\abackup>Pause
> Press any key to continue . . .

That is why I think that your aBackup directory is in the root
directory on rsyncsource:.

If you want to copy /aBackup/, etc. from rsyncsource: to /aBackup/,
etc. on your local machine, specify the root directory on the
source and the target:

  rsync --verbose --progress --stats -vv --recursive -e "ssh -p 2423"
  --include-from=includes.txt rsynchost:/ /
                                        ^ ^
But using a root directory for a target can be very dangerous if
you later add --delete and don't get things quite right.

I strongly suggest always using --dry-run (or -n) to test things out.
-- 
        John Van Essen  Univ of MN Alumnus  <vanes002 at umn.edu>



More information about the rsync mailing list