Simple RSYNC script

Job ID: 30696036

Budget: $10 – $20 USD

I need a script to backup a sub-directory that is part of every folder in a tree with 300+ folders. The requirements are:

1) Backup this folder ONLY from every directory AND maintain the folder structure
2) Have the ability to add a second or third folders if needed.
2) Recover the backup folders to the same location as in step 1.

Just to give you context, we are going to replace the entire tree, including root folder and sub-folders, but we need to retain the connections sub-folder in every project. Here is an example:

/var/www/ (ROOT)
/sub01/ (Level 1)
/sub02/ (Level 2)
/connections (Level 3) This is the one we need and all the contents inside.

/var/www/sub01/sub02/001/connections/*
/var/www/sub01/sub02/002/connections/*
/var/www/sub01/sub02/003/connections/*
/var/www/sub01/sub02/004/connections/*
/var/www/sub01/sub02/005/connections/*

Backup to /tmp

Restore to the same location.

/var/www/

/var/www/sub01/sub02/001/connections/*
/var/www/sub01/sub02/002/connections/*
/var/www/sub01/sub02/003/connections/*
/var/www/sub01/sub02/004/connections/*
/var/www/sub01/sub02/005/connections/*
Related categories: Linux Shell Script Bash Scripting