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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
11-05-2007, 03:44 AM
|
#1
|
LQ Newbie
Registered: Nov 2007
Posts: 2
Rep:
|
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
|
|
|
11-05-2007, 09:28 AM
|
#2
|
Member
Registered: Nov 2003
Location: South Jersey
Distribution: Slackware, Raspbian, Manjaro
Posts: 826
Rep:
|
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 09:35 AM.
|
|
|
11-08-2007, 01:37 AM
|
#3
|
LQ Newbie
Registered: Nov 2007
Posts: 2
Original Poster
Rep:
|
Quote:
Originally Posted by Vincent_Vega
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
|
|
|
11-08-2007, 09:34 AM
|
#4
|
Member
Registered: Nov 2003
Location: South Jersey
Distribution: Slackware, Raspbian, Manjaro
Posts: 826
Rep:
|
Glad I could help you.
|
|
|
All times are GMT -5. The time now is 02:54 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|