Rsync exclude & include?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Rsync exclude & include?
# 1  
Old 08-27-2016
Rsync exclude & include?

hi
I have a few folders and a few files , for example
Directory A B C D E
Files 1 2 3 4 5

I want B directory and "2" File that does not sync
But other directories and file sync

What is the solution ?
Is there a way to sync time is under one minute?
os centos 6.8
thanks...

Last edited by jim mcnamara; 08-27-2016 at 09:11 AM..
# 2  
Old 08-27-2016
man rsync is an invaluable source of information. e.g. it says - on top of filter rules - :
Quote:
--exclude=PATTERN exclude files matching PATTERN
--exclude-from=FILE read exclude patterns from FILE
# 3  
Old 08-27-2016
Are A, B and so on on separate physical mountpoints? or different servers?
I am assuming there are A, B ... directories one place and then another set of A, B ... directories somewhere else. Maybe far away.

As a side note - if these directories and files change a lot rsync may not be able to complete everything in less than one minute, depending on topology. Hypothetically --- This means running rsync in asynchronous mode - start every minute whether or not the other job completed - may cause a backlog. In cases like that sometimes NFS is a better choice.

So please give us a complete picture.
This User Gave Thanks to jim mcnamara For This Post:
# 4  
Old 08-27-2016
Thanks for replay
There are two serevers
192.168.10.242
192.168.10.243
that would be sync together
The command It does not work.
Code:
rsync -avzh --exclude=/var/www/html/B --include=/var/www/html/ user@192.168.10.243:/var/www/html

I want to all sync directory except B directory

Last edited by Chubler_XL; 08-28-2016 at 06:04 PM.. Reason: Please use code tags
# 5  
Old 08-28-2016
When specifying exclude paths then should be anchored to the root of the transfer path like this:

Code:
rsync -avzh --exclude=/B /var/www/html/ user@192.168.10.243:/var/www/html

Note: if you used just B instead of /B it would exclude all directories named "B" even in other sub folders (eg /var/www/html/backup/Fri/B would also be excluded)
These 2 Users Gave Thanks to Chubler_XL For This Post:
# 6  
Old 08-29-2016
thank u very much for your answer my problem to be solve
but when i want to have same storage what way can i use for it i mean two storage sync together
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Exclude txt file in rsync

Hi Folks, I'm using rsync on Solaris 10 to backup a web server and need to exclude the cache and tmp directories. The man pages and google on rsync --exclude are ambiguous but I have tried--exclude=".*" and --exclude/remote_server/absolute_path with success only on the tmp files. Rather than make... (2 Replies)
Discussion started by: SmokeyJoe
2 Replies

2. Shell Programming and Scripting

Little help with rsync --exclude

Loving the rsync command and beginning to write some scripts with it. However I'm hung up on the --exclude function. Script is tested and works great BEFORE I put the --omit in. What am I doing wrong in my syntax? rsync $OPTS /cis/cloverleaf/cis6.0/integrator/... (2 Replies)
Discussion started by: B_ROX
2 Replies

3. Red Hat

SFTP user include/exclude without preventing SSH login

I have been asked to see if we can restrict SFTP access to authorised users only. There will be business users who will log on with SSH, but they are locked into a menu. They will have write access to the production data to do their job, but we don't want them to have access to read/write the... (8 Replies)
Discussion started by: rbatte1
8 Replies

4. Shell Programming and Scripting

Using Grep Include/Exclude Files

I wrote this korn script and ran into a hole. I can use find to exclude all the hidden directories and to use my include file/exclude files for running a full backup find / -depth -ipath '/home/testuser/.*' -prune -o -print| grep -f include.mydirs | grep -v -f exclude.mydirs but when I... (8 Replies)
Discussion started by: metallica1973
8 Replies

5. UNIX for Advanced & Expert Users

imap & rsync - doing backup & restore

Hi ALL... I have an IMAP server & I have setup rsync to copy all mailboxes (MailDir) to a remote backup machine. rsync is working fine and is copying my files. I need some advice on how to restore a particular mailbox when a user makes a request assuming she has has deleted an important... (1 Reply)
Discussion started by: coolatt
1 Replies

6. Shell Programming and Scripting

rsync exclude option

Hi Frdz, i am using rsync to transfer files from source to destination. but i have one criteria like i have to tranfer only links from source to destination. in home/test/po folder i have kiran/test1 -> /home/test/lo/fg kiran/test2 -> /home/test/lo/fg2 like links are available.... (1 Reply)
Discussion started by: KiranKumarKarre
1 Replies

7. Shell Programming and Scripting

rsync - exclude statement not working

hey all, i'm trying to rsync some dir's and files between servers and i've added an exclude statement, but it still goes out and tries to rsync the directory. I've tried the following: --exclude="/export/home/zones/lab" as well as: --exclude=/export/home/zones/lab and also:... (1 Reply)
Discussion started by: em23
1 Replies

8. Shell Programming and Scripting

Creating and using a /.rsync/exclude

Hello all, Everyone has been awesome assisting with my rsync script... Now I want to clean it up. I think the best way for me to exclude many files might be to use a rsync exclude file. So in my script I add So now then, here is my .rsync/exclude... So what is happening is the... (0 Replies)
Discussion started by: komputersman
0 Replies

9. Shell Programming and Scripting

Exclude & Zip

Hi In unix i want to zip the files in a directory excluding *.dmp, *.log, *.lst, *.out files in that directory. pls let me know what command to use. $zip ........ ? Thanks (1 Reply)
Discussion started by: dreams5617
1 Replies

10. Programming

compiling with include & libs

I like to compile a cxx file with g++ compiler. I tried with option g++ -I<include path> -L<library path> source-file but ending with compilation error in /usr/local/bin/gcc-lib/.../crt1.o I think the libraries are not taken from proper path How to compile a cxx file with libraries... (1 Reply)
Discussion started by: ls1429
1 Replies
Login or Register to Ask a Question