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 |
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. |
Quote:
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 |
Glad I could help you.
|
All times are GMT -5. The time now is 01:00 AM. |