LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 07-13-2012, 02:45 AM   #1
gregmcc
Member
 
Registered: Mar 2007
Posts: 39

Rep: Reputation: 1
Rsync not working with include and delete.


I can't seem to get my head around rsync - the basic syncing I've got working but I now want to include certain files and use the delete option, but then it all goes wrong.

On the source I've got:

A_Folder/file1
A_Folder/file2
A_Folder/file3
B_Folder/file1
B_Folder/file2
B_Folder/file3
Z_Folder/file1
Z_Folder/file2
Z_Folder/file3


If my syntax is correct it should rsync A_Folder to the destination but it syncs everything. I want to sync A* and B* folders.

Also if I add a file to the destination is doesnt delete it!

rsync --progress --delete -avv --include '[A-B]*' --recursive /home/folder1/ /home/folder2/

Where am I going wrong?
 
Old 07-13-2012, 03:54 AM   #2
gregmcc
Member
 
Registered: Mar 2007
Posts: 39

Original Poster
Rep: Reputation: 1
Finally got it working:

rsync --progress --delete -avv --include '[A-B]*' --delete-excluded --exclude '*/' --recursive /home/folder1/ /home/folder2/
 
1 members found this post helpful.
Old 07-13-2012, 01:03 PM   #3
gregmcc
Member
 
Registered: Mar 2007
Posts: 39

Original Poster
Rep: Reputation: 1
Ok - its not working 100%. Its syncing the files in the directories. But if I have a subdirectory its not syncing.

So A_Folder/file1 is syncing, but not A_Folder/folder1

I think its got to do with my include/exclude but am not sure what. Its reporting this:

[sender] hiding directory A_Folder1/S01 because of pattern */ (S01 is a folder)
 
Old 07-13-2012, 01:39 PM   #4
gregmcc
Member
 
Registered: Mar 2007
Posts: 39

Original Poster
Rep: Reputation: 1
Answered my own question again - you need to use the include with a **
 
Old 07-13-2012, 02:42 PM   #5
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,540

Rep: Reputation: 462Reputation: 462Reputation: 462Reputation: 462Reputation: 462
Quote:
Originally Posted by gregmcc View Post
Answered my own question again - you need to use the include with a **


what a **?
 
Old 07-14-2012, 01:15 AM   #6
gregmcc
Member
 
Registered: Mar 2007
Posts: 39

Original Poster
Rep: Reputation: 1
It needs to be --include '[A-B]**'

The ** is for subdirectories.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
include and exclude in rsync xeon123 Linux - Newbie 4 05-26-2011 11:27 PM
rsync --delete not working shea1roh Linux - Software 2 04-06-2011 08:29 PM
rsync can not rsync files with include filter... xiutuo Linux - Server 2 07-23-2010 02:10 AM
rsync (cygwin on XP) - -delete flag not working. bobby953 Linux - Newbie 1 08-05-2009 10:13 AM
RSYNC and include?? JediKnight2 Linux - Software 0 02-04-2005 11:52 AM


All times are GMT -5. The time now is 05:23 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration