Hello Everyone,
I am trying to exclude a directory (and all file and sub-directories under that directory) when using rsync.
I have spent two days on google, but everything that I can find there involves excluding individual files, not an entire directory.
I have tried the following commands, but in each case the remove_dir and all of its sub-directories and files area still sent to the remote server.
1) rsync --delete --compress --archive --rsh=ssh --exclude="**/remove_dir/**" /local/path/ $user@$host:remote/path
2) rsync --delete --compress --archive --rsh=ssh --exclude="**/remove_dir/**" /local/path/ $user@$host:remote/path
3) rsync --delete --compress --archive --rsh=ssh --exclude="/local/path/**/remove_dir/**" /local/path/ $user@$host:remote/path
4) rsync --delete --compress --archive --rsh=ssh --exclude-from=/path/to/exclude_file /local/path/ $user@ $host:remote/path
and the /path/to/exclude_file contains: # don't include these files/dirs - **/remove_dir/**
Any thoughts on the proper way to exclude an entire directory and its sub-directories and files when doing an rsync? -- Doug
Registered Linux User #285548 (http://counter.li.org) ---------------------------------------- Random Thought: QOTD: If it's too loud, you're too old.
I am trying to exclude a directory (and all file and sub-directories under that directory) when using rsync.
I have spent two days on google, but everything that I can find there involves excluding individual files, not an entire directory.
Have you tried a simple "rsync --exclude remove_dir ..."?
Alfred
At Tue, 2 Oct 2007 it looks like Alfred von Campe composed:
I am trying to exclude a directory (and all file and sub-directories under that directory) when using rsync.
I have spent two days on google, but everything that I can find there involves excluding individual files, not an entire directory.
Have you tried a simple "rsync --exclude remove_dir ..."?
Alfred
I was tasked with backing up my /home/ directory but leave out stuff that I don't need like:
/home/wiliweld/.firefox
and other "dot" file directories.
So, first I'll show you the crontab entry by using the "crontab -l" command:
##################################################################
[root@liam ~]-> crontab -l
1 1 * * * /usr/bin/rsync -avz /home/wiliweld/ /data1/home-wiliweld/ --exclude-from=/root/rsync-exclude.txt
##################################################################
In my /root/rsync-exclude.txt file I have entries like this:
##################################################################
[root@liam ~]-> cat /root/rsync-exclude.txt
- .adobe/ - .beagle/ - .config/ - .fontconfig/ - .fonts/ - .gconf/ - .gconfd/ - .gimp-2.2/ - .gnome2/ - .gnome2_private/ - .gnupg/ - .java/ - .kde/ - .local/ - .macromedia/ - .mcop/ - .mozilla/ - .ooo-2.0/ - .pork/ - .qt/ - .sane/ - .skel/ - .supertux/ - .thumbnails/ - .vlc/ - .vmware/ - .wapi/ - .xemacs/ - .xine/ - .zinf/ - .DCOP*/ - .inputrc/ - .lesshst/ - .realplayerrc/
##################################################################
This may work. If worked, Pls reply to the list by appending SOLVED to the subject line. Then, Others can beniit.
rsync -avz --delete --exclude=**/stats --exclude=**/error --exclude=**/files/pictures -e "ssh -i /root/rsync/mirror-rsync-key" someuser@server1.example.com:/var/www/ /var/www/
(The --delete option means that files that have been deleted on server1.example.com should also be deleted on mirror.example.com. The --exclude option means that these files/directories should not be mirrored; e.g. --exclude=**/error means "do not mirror /var/www/error". You can use multiple --exclude options. I have listed these options as examples; you can adjust the command to your needs. Have a look at
another URL to read,
http://www.howtoforge.com/mirroring_with_rsync_p2
GOOD LUCK
On 10/3/07, Ski Dawg centos@skidawg.org wrote:
Hello Everyone,
I am trying to exclude a directory (and all file and sub-directories under that directory) when using rsync.
I have spent two days on google, but everything that I can find there involves excluding individual files, not an entire directory.
I have tried the following commands, but in each case the remove_dir and all of its sub-directories and files area still sent to the remote server.
- rsync --delete --compress --archive --rsh=ssh
--exclude="**/remove_dir/**" /local/path/ $user@$host:remote/path
- rsync --delete --compress --archive --rsh=ssh
--exclude="**/remove_dir/**" /local/path/ $user@$host:remote/path
- rsync --delete --compress --archive --rsh=ssh
--exclude="/local/path/**/remove_dir/**" /local/path/ $user@$host:remote/path
- rsync --delete --compress --archive --rsh=ssh
--exclude-from=/path/to/exclude_file /local/path/ $user@ $host:remote/path
and the /path/to/exclude_file contains: # don't include these files/dirs
- **/remove_dir/**
Any thoughts on the proper way to exclude an entire directory and its sub-directories and files when doing an rsync? -- Doug
Registered Linux User #285548 (http://counter.li.org)
Random Thought: QOTD: If it's too loud, you're too old.
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos