LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-05-2007, 04:44 AM   #1
LinuxLuva
LQ Newbie
 
Registered: Nov 2007
Posts: 2

Rep: Reputation: 0
Rsync - Exclude single file problem


Hi Guys,

Hoping you can help me with a rsync problem.

I'm successfully able to sync two directories via Rsync, my problem is that i want to exclude 1 local file from being updated from the remote. Here is the command :

rsync -avz --delete --exclude=/path/to/directory-to-sync/file.xxx -e "ssh -i /path/to/key" user@remote:/path/to/directory-to-sync/ /path/to/directory-to-sync/

Now i've tried exclude-from and a file as well which yields the same results. Can anyone point out what im doing wrong.

Thanks
 
Old 11-05-2007, 10:28 AM   #2
Vincent_Vega
Member
 
Registered: Nov 2003
Location: Jacksonville, FL
Distribution: Slackware & Arch
Posts: 825

Rep: Reputation: 31
The man page for rsync offers a lot of detail and would help you sort this out. The 'exclude-from' option is used when you have several patterns you want to exclude. The file you then specify is actually a file listing those patterns, not the files you want to ignore. For instance:
--exclude-from=/home/me/badfiles.txt
and in 'badfiles.txt' I would have each pattern listed on individual lines:
*.mpg
Holiday*2007.jpg
And those two lines would tell my rsync to ignore all files with the .mpg extension as well as all jpg files beginning with 'Holiday' and ending with '2007', like Holiday_01_2007.jpg, Holiday_02_2007.jpg, etc.
Since you're only looking for a pattern, using the full path the way you have described isn't going to work. Try using just the filename. For instance:
--exclude=*.mpg
or
--exclude=badfile.txt
Post back with results.

Last edited by Vincent_Vega; 11-05-2007 at 10:35 AM.
 
Old 11-08-2007, 02:37 AM   #3
LinuxLuva
LQ Newbie
 
Registered: Nov 2007
Posts: 2

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Vincent_Vega View Post
The man page for rsync offers a lot of detail and would help you sort this out. The 'exclude-from' option is used when you have several patterns you want to exclude. The file you then specify is actually a file listing those patterns, not the files you want to ignore. For instance:
--exclude-from=/home/me/badfiles.txt
and in 'badfiles.txt' I would have each pattern listed on individual lines:
*.mpg
Holiday*2007.jpg
And those two lines would tell my rsync to ignore all files with the .mpg extension as well as all jpg files beginning with 'Holiday' and ending with '2007', like Holiday_01_2007.jpg, Holiday_02_2007.jpg, etc.
Since you're only looking for a pattern, using the full path the way you have described isn't going to work. Try using just the filename. For instance:
--exclude=*.mpg
or
--exclude=badfile.txt
Post back with results.
Hi Vincent,

That worked perfectly, The problem as you pointed out was that i added the full path and filename inside the file "badfile.txt" instead of the pattern.

Thank you
 
Old 11-08-2007, 10:34 AM   #4
Vincent_Vega
Member
 
Registered: Nov 2003
Location: Jacksonville, FL
Distribution: Slackware & Arch
Posts: 825

Rep: Reputation: 31
Glad I could help you.
 
  


Reply


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
help with rsync exclude syntax please JacekZ Linux - General 2 07-08-2007 02:23 PM
What files to exclude when using rsync TongueTied Linux - General 2 07-20-2006 09:39 PM
can't get rsync exclude files Batta Linux - Newbie 1 03-27-2006 11:39 PM
rsync exclude list steelhead79 Linux - Software 3 01-14-2005 01:10 PM
Using the exclude option absolutely with rsync karlovac Programming 0 03-01-2004 01:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:40 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration