1

I have looked at previous posts but cannot get this working. I want to just rsync all the server03 directories and any sub directories of them to a new server. I tried the following but it was picking up other directories other than server03. I guess I am missing something obvious. The structure is which I want to copy from is

/backup
/backup/day1
/backup/day1/xxxx
/backup/day1/server03
/backup/day1/yyyy

etc to

/backup/day31......

rsync --include="*/" --include="**server03/***" --exclude="*" -avzh root@fromserver:/backup /opt/backupfolder
Kezza
  • 11
  • 1
    refer this link http://unix.stackexchange.com/questions/267352/rsync-complication-on-sync, it might help. – AReddy Jun 07 '16 at 03:01

1 Answers1

0

If you can run it on source ('fromserver'):

find /backup -name server03 | while read i; do echo $i; mkdir -p /dest/dir/$i/; rsync -avzj --progress $i/ /dest/dir/$i/ ; done

mkdir is needed if you want to keep structure like

/backup/day1/server03
/backup/day2/server03
/backup/day3/server03

etc

Putnik
  • 886