I’m looking to rsync only specific files and directories from a cpanel backup to a remote server.
The basic structure is:
/backup/cpbackup/daily/USERNAME
from within USERNAME directory I want to backup
../USERNAME/mysql/USERNAME.sql
and also a folder (containing files and subfolders)
../USERNAME/homedir/siteassets
so I end up on my remote server with:
/USERNAME/mysql/USERNAME.sql
/USERNAME/homedir/siteassets
I could use wildcards
rsync /backup/cpbackup/daily/*/mysql/*.sql user@remote.ip.address:servername/
but this won’t give me the USERNAME folder remotely and will mean all the files end up getting merged. I assume this is possible by iterating through folders with bash or something like tht but thats not my strong point
Answered it myself: