Here's a snippet of code from the PHP site that I pointed you to in the comments. All it does is take a directory path (as a string) and output the full pathname of all files inside it (as a number of strings). This is very useful, as we can use this ability to do something to files on an individual basis (like upload them to Dropbox).
$object) {
echo "$name\n";
}
So, since you're wanting to learn PHP, and since you'll not learn anything if I give you a ready-made solution :-), try the following:
- Remove the
system call from your code, since you don't want to do any compression
- Get the snippet I've provided working on your machine (it will work on its own), changing '/etc' to whatever path you want
- Change
$path in my code to $siteroot which you use in yours
- Remove the
$path = ... line in my code (since you define $siteroot yourself)
- Test the snippet again
- Add in the
$objects line from my code after you define $siteroot, into your code
- Wrap the
$uploader->upload() line in your code with the for loop I provide, removing the echo statement from my code
- Change
$name to $backup_files in your code
Jiggle it all about a bit, and it should work. Good luck, and feel free to ask questions!