Welcome to the most active Linux Forum on the web.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 03-01-2004, 12:39 PM   #1
LQ Newbie
Registered: Mar 2004
Posts: 25

Rep: Reputation: 15
Using the exclude option absolutely with rsync

I've discovered that any pattern specified for the --exclude option when rsyncing is treated as relative to the source destination, so:

rsync -azn -e ssh --exclude /foo/ /var/www/html/
... means "exclude /var/www/html/foo/" not exclude "/foo/".

Is there any practical way around this? I have a shell script that builds up an rsync command based on arguments (e.g. "sync the entire website, sync just HTML files etc, sync a user-specified directory, sync just a single user-specified file etc.), but directories to be excluded must be absolutely specified. For example there is a list of directories I never want to sync:


Clearly my way of building up an rsync command by iterating through the exclude options is no good.

The only other approach I can think of is to always use / as the source, and then have a bunch of absolute exclude options, and one single include option that specifies what to actually sync.




Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
wget --exclude-directories option broken? (fc2) fsbooks Fedora 3 06-20-2009 06:08 PM
tar --exclude --exclude-from cefn Linux - Software 4 10-11-2005 07:31 PM
Absolutely no clue tuananhbirm Mandriva 2 06-05-2005 11:48 AM
rsync exclude list steelhead79 Linux - Software 3 01-14-2005 12:10 PM
Windows Rsync Upload to Linux Rsync - permissions inspleak Linux - Software 0 10-12-2004 02:49 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:05 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration