This is a script that copies directories from A to B. It does not compress directories into an archive, though you are welcome to adapt your script using snippets from this post....
Backing up production databases regularly is very important. I am self-hosting Leanote, an open-source note taking application server and that required some kind of automated daily backups....