Ok. I got this done. To review, I offer a demo site for users be able to test drive the Joomla! CMS software platform. I want to reset the site every hour so that any edits people have made will be undone.
To completely delete the Joomla! demo directory your cron command is:
rm -r -f /home/xweb3x10/public_html/_DEMO/JOOMLAD/
To copy an archive directory to the demo directory your cron command is:
cp -r /home/xweb3x10/public_html/_DEMO/ARCHIVE/JOOMLAD /home/xweb3x10/public_html/_DEMO
To delete the database, create the database and import the data you'll need to create a file named /home/xweb3x10/scripts/restore_data.sh containing the following code (adjusted for your db credentials)
#! /bin/sh
TERM=dumb
export TERM
clear;
#here the script deletes all your tables in the database
mysql -u xweb3x10_demos -ppassword -e 'drop database xweb3x10_demos;'
mysql -u xweb3x10_demos -ppassword -e 'create database xweb3x10_demos;'
#here the script restores the database
mysql -u xweb3x10_demos -ppassword xweb3x10_demos < /home/xweb3x10/backups/demo.sql
Then, via phpmyadmin, export your database to home/xweb3x10/backups/demo.sql
Once done, your cron command is:
/home/xweb3x10/scripts/restore_data.sh
I also wanted to create a log for any errors. You can do this by adding the following code to any cron command:
>>/home/xweb3x10/public_html/cronlog.txt 2>&1
For example:
rm -r -f /home/xweb3x10/public_html/_DEMO/JOOMLAD/ >>/home/xweb3x10/public_html/cronlog.txt 2>&1
I needed to make sure all of these cron commands ran as quickly as possible and consecutively (not individually) . This is important because I don't want to be copying a file or folder that has not yet been deleted. To do this I concatenated them using &&. Here is the result:
0 * * * * rm -r -f /home/xweb3x10/public_html/_DEMO/JOOMLAD/ && cp -r /home/xweb3x10/public_html/_DEMO/ARCHIVE/JOOMLAD /home/xweb3x10/public_html/_DEMO && /home/xweb3x10/scripts/restore_data.sh && >>/home/xweb3x10/public_html/cronlog.txt 2>&1
Note: To verify that this all works I created a directory in the demo folder via ftp and a new table via phpmyadmin. Once the command completed the routine I checked for the folder and the table to ensure they were deleted. The emailing part was no longer necessary for me once I eliminated all errors and the command performed as desired.