Using PHP to back up site files to a local server

Hello!

I use PHP with CRON to perform a daily back-up of my MySql database. One other aspect of my site that I’d like to back up is a set of folders and its contents, contained within an “uploads” folder. The number of directories within the uploads folder will be changing as users increase, as will the files within the sub-directories of the uploads folder.

Is there a way that I can use PHP to back-up these files locally? What I’m looking for is an automated way to “get” my files from my server, much in the same way that I can use Dreamweaver to do the process, and then deliver them to my hard-drive with the same directory structure.

At the moment, I know how to download individual files to my “Downloads” folder with PHP, but think that there should be a cleaner solution
to maintain the directory hierarchy.

Any help in at least starting this process would be appreciated; and if there’s a more efficient method outside of PHP to automatically copy a directory, its sub-directories, and all of its files to my local testing server, then I’m all ears.

Thank you!

-Eric

I suppose you could do it with the file functions in PHP, but on a *nix box you might find a shell script is more powerful, less overhead and less problematic. Or try bacula or similar product.

Thanks for the tip!