LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Rsync - Exclude single file problem (https://www.linuxquestions.org/questions/linux-software-2/rsync-exclude-single-file-problem-597209/)

LinuxLuva 11-05-2007 03:44 AM

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

Vincent_Vega 11-05-2007 09:28 AM

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.

LinuxLuva 11-08-2007 01:37 AM

Quote:

Originally Posted by Vincent_Vega (Post 2948846)
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

Vincent_Vega 11-08-2007 09:34 AM

Glad I could help you.


All times are GMT -5. The time now is 01:00 AM.