|
From: Nicolas KOWALSKI on 7 May 2008 04:34 On Wed, 7 May 2008, Matthew Lincoln wrote: > As I learned from the man page of rsync I can exclude a certain > directory (trees) by using the --exclude option like in > > rsync .... --exclude=/proc .... > > But how do I exclude multiple directory (trees) at once in such a > rsync command? Use multiple "--exclude /path/to/unwanted/directory/" options. rsync ... \ --exclude /proc/ \ --exclude /var/ \ --exclude /dummy/ \ ... This works well. -- Nicolas
From: Chris Davies on 7 May 2008 04:42 In comp.os.linux.misc Matthew Lincoln <kmlincoln100(a)hotmail.com> wrote: > As I learned from the man page of rsync I can exclude a certain > directory (trees) by using the --exclude option like in > rsync .... --exclude=/proc .... > But how do I exclude multiple directory (trees) at once in such a > rsync command? You get good marks for reading the man page. (You'd be amazed how many people don't even bother to try...) I think the bit you missed is this: Note also that the --filter, --include, and --exclude options take one rule/pattern each. To add multiple ones, you can repeat the options on the command-line [...] Personally, I don't find the interaction between the --include/--exclude directives particularly intuitive. If it's simply a case of "exclude this and that", then you should be fine. However, as soon as I wanted to "include this but exclude that", I ended up taking some of the working examples (from the man page) and tweaking them until I got something that worked. Chris
From: Kevin the Drummer on 7 May 2008 11:09 Matthew Lincoln <kmlincoln100(a)hotmail.com> wrote: > As I learned from the man page of rsync I can exclude a certain > directory (trees) by using the --exclude option like in > > rsync .... --exclude=/proc .... > > But how do I exclude multiple directory (trees) at once in such > a rsync command? The following does not work: Use multiple '--exclude=' rsync .... --exclude=/proc --exclude=/net --exclude=/tmp G'luck... -- PLEASE post a SUMMARY of the answer(s) to your question(s)! Show Windows & Gates to the exit door. Unless otherwise noted, the statements herein reflect my personal opinions and not those of any organization with which I may be affiliated.
From: Bruce Esquibel on 7 May 2008 12:08 In comp.security.ssh Matthew Lincoln <kmlincoln100(a)hotmail.com> wrote: > As I learned from the man page of rsync I can exclude a certain directory (trees) > by using the --exclude option like in > rsync .... --exclude=/proc .... > But how do I exclude multiple directory (trees) at once in such a rsync command? > The following does not work: Check the man page for --exclude-from= You just need to set up a simple text file will all the excludes and call rsync with the --exclude-from= to read the file in. -bruce bje(a)ripco.com
From: loki harfagr on 7 May 2008 13:45
On Wed, 07 May 2008 05:57:09 +0000, Matthew Lincoln wrote: > As I learned from the man page of rsync I can exclude a certain > directory (trees) by using the --exclude option like in > > rsync .... --exclude=/proc .... > > But how do I exclude multiple directory (trees) at once in such a rsync > command? The following does not work: > > rsync .... --exclude=/proc||/var||/dummy .... > > Same with "&&" instead of "||" you may use a file with: --exclude-from=FILE ((Linux manpage 2-79): This option is related to the --exclude option, but it specifies a FILE that contains exclude patterns (one per line). Blank lines in the file and lines starting with ';' or '#' are ignored. If FILE is -, the list will be read from standard input. ) for instance, I used it this way in a quick&dirty backup script ------- EXCLUDED="- junk/ - .thumbnails/ - .googleearth/ - .macromedia/ - .kde/ " .... echo "${EXCLUDED}" | rsync -vax --delete /home --cvs-exclude --exclude-from=- --delete-excluded ${BKUPDIR} ------- |