LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to exclude specific directories from an rsync backup (http://www.linuxquestions.org/questions/linux-software-2/how-to-exclude-specific-directories-from-an-rsync-backup-642150/)

kaplan71 05-14-2008 10:39 AM

How to exclude specific directories from an rsync backup
 
Hi there --

I am running rsync and I want to exclude several directories from the backup. The directories in question are the following:

/usr/maui
/usr/oahu
/usr/tools

The directories in question are all NFS mounts. What is the correct syntax to use so that while the /usr directory on the local system is backed up, the NFS directories shown above are not included in it? Thanks.

weibullguy 05-14-2008 11:51 AM

Take a look at the rsync manpage for the --filter, --exclude, and --exclude-from options.

kaplan71 05-16-2008 12:09 PM

Hi there --

Thanks for your reply. I tried several different syntaxes which are shown below:

Code:

rsync --exclude -lq /usr/tools --exclude -lq /usr/maui --exclude -lq /usr/oahu -e ssh -alrvz / <remote ip>:/<directory>
Code:

rsync --exclude -lq /usr/tools/* --exclude -lq /usr/maui/* --exclude -lq /usr/oahu/* -e ssh -alrvz / <remote ip>:/<directory>
Both instances resulted in a list of files and directories that could not be backed up due to permissions issues. Here is a sample of the output that I am seeing:

Quote:

rsync: opendir "/usr/maui/cjr3/.dt/Desktop" failed: Permission denied (13)
rsync: opendir "/usr/maui/cjr3/.hh" failed: Permission denied (13)
rsync: opendir "/usr/maui/cjr3/.netscape" failed: Permission denied (13)
rsync: opendir "/usr/maui/dag26/.dt/Desktop" failed: Permission denied (13)
rsync: opendir "/usr/maui/dal19/.dt/Desktop" failed: Permission denied (13)
rsync: opendir "/usr/maui/dal19/.hh" failed: Permission denied (13)
rsync: opendir "/usr/maui/dal19/.kde/share/config" failed: Permission denied (13)
The files shown in the error output were located in those directories that were supposed to be excluded from the rsync backup. My syntax is wrong, but I am not sure what the correct version is to use.


All times are GMT -5. The time now is 09:29 AM.