linux - Rsync syntax to copy specific subfolders -
alright web server has following file structure
/ /home /home/username /home/username/public_html /home/username/mail /home/username/etc ... /home/username2 /home/username2/public_html ... so im trying figure out way of doing cronjob rsync wich synchronise public_html folder of 600 accounts have. thought of maybee doing exclusion list every other subfolder name there under accounts directories wasn't sure optimal solution
is there way of telling rsync sync content of public_html folders without having manually type in 600 accounts? thanks
ps.: current solution amongst lines of :
rsync –varu –exclude ‘mail*’ -exclude 'etc*' home root@xxx.xxx.xxx.xxx:home with solution if filenames match directories name won't copied over.
you can using 3 filters:
rsync -av --filter="+ /home" \ --filter="+ /home/*" \ --filter="+ /home/*/public_html" \ --filter="+ /home/*/public_html/**" \ --filter="- *" / root@xxx.xxx.xxx.xxx:mirror it important add "+" filter directories in tree before public_html , "**" include behind public_html.
the drawback home directories created on destination empty dirs.
Comments
Post a Comment