This is simple script to copy sql.gz by ftp, extract the database, import it in other database and archive the base once again. After creating the backup databe file with a name fuction of the date, the scritp is storing the database in new folder with generated name from the  year-mounth with subfolder for every day