What @halfer is suggesting is this (I just modified your potential solution based on his idea) so he should take credit:
<?php
function uploadx($dirtocopy, $dropboxdir, $uploader){
if ($handle = opendir($dirtocopy)) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") {
if(is_dir($entry)){
uploadx($dirtocopy.$entry.'/', $dropboxdir.$entry.'/', $uploader);
} else {
$uploader->upload($dirtocopy.$entry, $dropboxdir.$entry);
}
}
}
closedir($handle);
}
}
// Dropbox username/password
$dropbox_email='dropbox@dropbox.com';
$dropbox_pass='password';
// File to backup
$siteroot = "./";
include("DropboxUploader.php");
$uploader = new DropboxUploader($dropbox_email, $dropbox_pass);
uploadx($siteroot, 'Backup/Files/', $uploader);
?>
BTW, the function above is from here: How to backup files from a specific directory to Dropbox using PHP only?