Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
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.
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.
What is the actual command you are issuing? Are you excluding ss or including the other three or both? If you explicitly include '/tt/ss/' before setting up your exclusions, it should work. Also, if you explicitly exclude '/ss/' it shouldn't skip '/tt/ss' because that's akin to anchoring it. So make sure you've gone over the man page carefully and post your exact command line.
I know I can use the exclude option in the rsync command but I have more dir to exclude than just one. This is only an example to illustrate the problem.thanks
Well, it was long time ago when I faced same problem. I started reading rsync documentation and discovered it accepts .cvsignore files. In short, create a file named .cvsignore in every directory you do not want to back up. This file must contain at least a single symbol '*'.
thanks Emerson. Do I need to create that file within every directory including sub directories? or just on the root? I have around 12 directories to exclude and each of them have at least 5 subdirectories. thanks
Root will suffice, as it was long time ago when I read that documentation I do not remember all the options. I think you can create various filters playing with contents of .cvsignore file. An * will just include everything.
As mentioned, the red slash is important. Works the same with an exclude file, too.
Code:
:mkdir -p ~/tmp/rsync_test/{src,dest}
:mkdir -p ~/tmp/rsync_test/src/{tt/ss,pp,mm,ss}
:rsync -avv --exclude=ss ~/tmp/rsync_test/src/ ~/tmp/rsync_test/dest/
building file list ...
[sender] hiding directory ss because of pattern ss
[sender] hiding directory tt/ss because of pattern ss
done
delta-transmission disabled for local transfer or --whole-file
./
mm/
pp/
tt/
total: matches=0 hash_hits=0 false_alarms=0 data=0
sent 116 bytes received 44 bytes 320.00 bytes/sec
total size is 0 speedup is 0.00
:rsync -avv --exclude=/ss ~/tmp/rsync_test/src/ ~/tmp/rsync_test/dest/
building file list ...
[sender] hiding directory ss because of pattern /ss/
done
delta-transmission disabled for local transfer or --whole-file
tt/ss/
total: matches=0 hash_hits=0 false_alarms=0 data=0
sent 132 bytes received 50 bytes 364.00 bytes/sec
total size is 0 speedup is 0.00
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.