This is a discussion on How to exclude MULTIPLE directories in a rsync command ? within the Linux Networking forums, part of the Linux Forums category; As I learned from the man page of rsync I can exclude a certain directory (trees) by using the --exclude ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 "||" Matthew |
|
|||
|
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 "||" > > Matthew Use multiple --exclude=dir arguments. -Wayne |
|
|||
|
On 7 May, 06:57, kmlincoln...@hotmail.com (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 "||" > > Matthew Try 'rsync --exclude=/proc --exclude=/var --exclude=/dummy |
|
|||
|
On Wednesday 7 May 2008 07:57, 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 can repeat --exclude many times to specify multiple exclusions. Alternatively, you can use the --exclude-from option and put the names to be excluded in a file, one per line. Read man rsync for the details. -- D. |
|
|||
|
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 .... > rsync .... --exclude=/proc --exclude=/var --exclude=/dummy |
|
|||
|
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 |
|
|||
|
In comp.os.linux.misc Matthew Lincoln <kmlincoln100@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 |
|
|||
|
Matthew Lincoln <kmlincoln100@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. |
|
|||
|
In comp.security.ssh Matthew Lincoln <kmlincoln100@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@ripco.com |
|
|||
|
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} ------- |
![]() |
| Thread Tools | |
| Display Modes | |
|
|