SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist
    Join Date
    Mar 2011
    Location
    Bellingham, WA
    Posts
    450
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    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

  2. #2
    SitePoint Evangelist speda1's Avatar
    Join Date
    Jan 2002
    Posts
    550
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  3. #3
    SitePoint Evangelist
    Join Date
    Mar 2011
    Location
    Bellingham, WA
    Posts
    450
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the tip!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •