LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices


Reply
  Search this Thread
Old 10-04-2007, 11:38 AM   #1
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Rep: Reputation: 77
RSYNC Exclusion?


Guys,

I have the following RSYNC set in cron to run daily and it works great however there is one small detail I was wondering ....

I am telling RSYNC to take everything in my /home/cwilliams directory and sync it with an external USB hard drive mounted under /media/disk.

Here is the cron job...

Code:
# m h  dom mon dow   command
0 3 * * * rsync --delete -rdtvu /home/cwilliams/ /media/disk
As you can see if a file is /media/disk that is not present in my home directory, it deletes it from /media/disk.

But my main question is... how can I exclude the sync of the /home/cwilliams/Desktop directory? Is there a way to exclude the Desktop folder from syncing with /media/disk?
 
Old 10-04-2007, 11:48 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
You may simply add the option
Code:
--exclude=/home/cwilliams/Desktop/
where the slash at the end is mandatory to let rsync correctly interpret the pattern.
 
Old 10-04-2007, 11:56 AM   #3
dv502
Member
 
Registered: Sep 2006
Location: USA - NYC
Distribution: Whatever icon you see!
Posts: 642

Rep: Reputation: 57
Add the --exclude=PATTERN option

for more options do

Code:
man rsync
 
Old 10-04-2007, 03:37 PM   #4
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Original Poster
Rep: Reputation: 77
Quote:
Originally Posted by colucix View Post
You may simply add the option
Code:
--exclude=/home/cwilliams/Desktop/
where the slash at the end is mandatory to let rsync correctly interpret the pattern.
I am just unsure where that fits into my command. I would not think at the end...right?
 
Old 10-04-2007, 06:13 PM   #5
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
It can be anywhere in the OPTIONS section, for example
Code:
rsync --delete --exclude=/home/cwilliams/Desktop/ -rdtvu /home/cwilliams/ /media/disk
 
  


Reply



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
DHCP address exclusion Trollslayer Linux - Networking 2 07-12-2007 07:40 AM
sed inclusion/exclusion jinksys Programming 2 05-01-2007 09:42 PM
pthreads and I/O mutual exclusion oulevon Programming 6 04-29-2006 09:33 PM
BASH; exclusion list and cp TheLinuxDuck Programming 3 03-10-2005 01:59 PM
interrupts and mutual exclusion jwstric2 Programming 1 12-09-2004 03:36 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > General

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

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