LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Rsync exclude a directory with all subdirectories and files (http://www.linuxquestions.org/questions/slackware-14/rsync-exclude-a-directory-with-all-subdirectories-and-files-852511/)

Slackovado 12-26-2010 09:17 PM

Rsync exclude a directory with all subdirectories and files
 
Hi,
Just a quick question about rsync.
In reading the rsync man page and browsing a lot of websites, I ended up a bit confused, or maybe it was just too much eggnog :).
Anyway, to exclude a directory "videos" with everything in it, which is
/home/user1/camera/videos
and I'm rsyncing the whole user1 directory to an external drive

Code:

--exclude /camera/videos /home/user1 /some_external_drive
--exclude /camera/videos/ /home/user1 /some_external_drive

does not exclude the directory videos, which I want to exclude
But when I omit the front slash, it works
Code:

--exclude camera/videos /home/user1 /some_external_drive
Now, from the manpage
Quote:

a trailing "dir_name/***" will match both the directory (as if
"dir_name/" had been specified) and everything in the directory
(as if "dir_name/**" had been specified). This behavior was
added in version 2.6.7
So am I to understand that if I use
Code:

--exclude camera/videos/*** /home/user1 /some_external_drive
will work also?
Thanks

mRgOBLIN 12-27-2010 12:40 AM

I'd say
Code:

--exclude='camera/videos/'
The trailing slash should be enough to let rsync know it's a directory.


All times are GMT -5. The time now is 10:06 PM.