LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-07-2007, 08:23 PM   #1
cucolin@
Member
 
Registered: Nov 2003
Location: USA
Distribution: Ubuntu, CentOS, RedHat
Posts: 416

Rep: Reputation: 31
Question excluding folders in a rsync command troubles


This is the case. I have:

/dir
which has:
/tt
/pp
/mm
/ss

I want to rsync folders /tt, /pp and /mm, but I want to exclude folder /ss.

Problem:

folder /tt has a directory within name /ss and is giving me this message:

excluding directory /tt/ss because of pattern ss

How would I do this??

thanks
 
Old 04-07-2007, 08:44 PM   #2
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
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.
 
Old 04-08-2007, 04:58 PM   #3
cucolin@
Member
 
Registered: Nov 2003
Location: USA
Distribution: Ubuntu, CentOS, RedHat
Posts: 416

Original Poster
Rep: Reputation: 31
This is the command:

rsync --exclude-from <excludefile> -avve /usr/bin/ssh /Volumes/DataHD/dir /Volumes/backupdisk

This is my exclude file:

ss

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
 
Old 04-08-2007, 05:32 PM   #4
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
I created .cvsignore files in all directories I do not want to back up. Works for me.
 
Old 04-08-2007, 07:44 PM   #5
cucolin@
Member
 
Registered: Nov 2003
Location: USA
Distribution: Ubuntu, CentOS, RedHat
Posts: 416

Original Poster
Rep: Reputation: 31
I research that, I not familiar with .cvsignore. Is it possible that you can give me some examples. thanks

Last edited by cucolin@; 04-08-2007 at 07:46 PM.
 
Old 04-08-2007, 08:33 PM   #6
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
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 '*'.
 
Old 04-09-2007, 09:22 AM   #7
cucolin@
Member
 
Registered: Nov 2003
Location: USA
Distribution: Ubuntu, CentOS, RedHat
Posts: 416

Original Poster
Rep: Reputation: 31
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
 
Old 04-09-2007, 09:34 AM   #8
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
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.
 
Old 04-09-2007, 02:46 PM   #9
cucolin@
Member
 
Registered: Nov 2003
Location: USA
Distribution: Ubuntu, CentOS, RedHat
Posts: 416

Original Poster
Rep: Reputation: 31
Emerson I followed your steps and still no solution. thanks
 
Old 04-09-2007, 03:00 PM   #10
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
Sorry to hear it, as I said, works for me.
 
Old 04-09-2007, 03:09 PM   #11
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
I just had a look at rsync man page and it clearly states it should "auto-ignore files in the same way CVS does" when invoked with -C option.
 
Old 04-09-2007, 03:36 PM   #12
cucolin@
Member
 
Registered: Nov 2003
Location: USA
Distribution: Ubuntu, CentOS, RedHat
Posts: 416

Original Poster
Rep: Reputation: 31
I was reading it too and I used the -C and nothing happen. See my command below:

rsync -avv -C --exclude-from=<excludefile> /Users/user/testdir /Users/user

I also tried --cvs-exclude and -avvC together and still get the same results.

excluding directory testdir/ss/tt bacause of pattern tt/

I want directory /ss and all subdirectories to be included, but since in the testdir there are:

/pp
/tt
/ss/tt

the exclude files has the tt pattern.

Last edited by cucolin@; 04-09-2007 at 03:39 PM.
 
Old 04-09-2007, 03:41 PM   #13
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
OK, here's mine:

rsync -Cav --delete --bwlimit=1000 /one/location /another/location
 
Old 04-09-2007, 04:04 PM   #14
cucolin@
Member
 
Registered: Nov 2003
Location: USA
Distribution: Ubuntu, CentOS, RedHat
Posts: 416

Original Poster
Rep: Reputation: 31
excluding directory testdir/ss/tt bacause of pattern tt
 
Old 04-09-2007, 08:21 PM   #15
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
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
 
  


Reply



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
rsync daemon or not - multiple folders yull Linux - General 4 02-24-2009 05:09 AM
Using rsync to backup data. Best way to backup folders? Micro420 Linux - General 2 11-23-2006 01:13 AM
Excluding Folders with CP Luke_C Linux - General 17 07-27-2006 04:22 AM
Excluding specific folders from backup karloslambchop Ubuntu 7 07-21-2006 08:10 PM
using rsync - one of the folders in path has spaces??? jgruss Linux - Networking 10 07-07-2004 07:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:14 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration