Re: Rsync prune entire subtree, not just pattern
From: Dirk Gouders (gouders_at_et.bocholt.fh-ge.de)
Date: 02/07/05
- Next message: Sudheer: "Nasty fork() bomb"
- Previous message: Chris F.A. Johnson: "Re: shell scripts and cron"
- In reply to: Greg Orange: "Rsync prune entire subtree, not just pattern"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 07 Feb 2005 08:47:39 +0100
> I'm using rsync with the --exclude-from=file.txt option, and I don't
> know how to make it's behaviour model what I want. For example, I wish
> to not sync the /share directory of the source machine, so my file.txt
> simply looks like this:
>
> share
You should place a line "/share" in your exclude file.
To avoid misunderstandings, assume the following directory tree
somewhere in the filesystem:
/some/where/testdir
/some/where/testdir/bin
/some/where/testdir/share
/some/where/testdir/share/info
/some/where/testdir/share/man
/some/where/testdir/usr
/some/where/testdir/usr/share
and you want to rsync everything under /some/where/testdir but the
whole subtree /some/where/testdir/share. Now, you have to decide if
you want to have the testdir prefix in your copy or not and invoke
rsync with a propper source specification and exclude pattern.
If you want to have testdir in your copy, use:
rsync -a --exclude="/testdir/share" /some/where/testdir /target/dir/
This command would create the copy:
/target/dir/testdir
/target/dir/testdir/bin
/target/dir/testdir/usr
/target/dir/testdir/usr/share
If you do not want testdir in your copy, use:
rsync -a --exclude="/share" /some/where/testdir/ /target/dir/
(Note the trailing slash (/) in the source specification.)
This command would create the copy:
/target/dir/
/target/dir/bin
/target/dir/usr
/target/dir/usr/share
Dirk
- Next message: Sudheer: "Nasty fork() bomb"
- Previous message: Chris F.A. Johnson: "Re: shell scripts and cron"
- In reply to: Greg Orange: "Rsync prune entire subtree, not just pattern"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]