Archiving and moving files into directories, creating directories, etc.

how can i move "dataName".sql.gz into a folder called 'database' and then move "$fileName".tar.gz * .htaccess into a folder called 'www' with the entire gzipped file being "$fileName".tar.gz? Is this doable or overly complex.

so

mydemo--2015-03-23-1500.tar.gz
> database
- _mydemo--2015-03-23-1500.sql.gz
> www
- all the files

instead of

mydemo--2015-03-23-1500.tar.gz
- _mydemo--2015-03-23-1500.sql.gz
- all the files

projectName="mydemo"
backupDir="/home/username/_backups"

fileName="$projectName"-$(date +"%Y-%m-%d-%H%M")
dataName="_$projectName"-$(date +"%Y-%m-%d-%H%M")

mysqldump -h "$host" -u "$username" -p"$password" "$dbName" | gzip > "$dataName".sql.gz
tar -zcf "$fileName".tar.gz * .htaccess &&
    rm -f "$dataName".sql.gz
mkdir -p "$backupDir";
mv "$fileName".tar.gz "$backupDir"

It happens because you create the sql dump in the current directory of which you then make a tarball.

--> Make the tarball first, then do the sql dump.
--> Then move the two *gz files to backupdir

EDIT:
No wait, you delete the dump.gz after you added it to the tarball... so... i'm confused now...
Maybe you wanted something like

mysqldump -h "$host" -u "$username" -p"$password" "$dbName" | gzip > "$backupDir/$dataName".sql.gz

hth

i want to take the database archive, put it in _backups in a folder called 'database', then i want to take the site, put it in _backups in a folder called 'www', and have the entire thing archived.

Then replace the red marked string with _backups/database .
But leave your original script otherwise intact.

hth

i want each individual archive to contain a folder for www and database... so _backups is currently the parent directory of the final archive file... which just throws the database and the files in the same folder and zips it up. i want to create more structure in my archive.

Could you please provide a trees of both, your pwd (where you create the tarballs) and desired output?
From the sound of your last post, i assume you are in the www directory.