SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Jun 2013
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cron job to copy files from one directory to another. Please Help

    I'm making a demo site for my visitors to test run my script. I need it to reset every hour. I've set up a cron job to do the database, but I'm wanting any changes done on the filesystem to be reverted too. So lets say I want to copy /source/ to /destination/ How do I remove any files from /destination/ before making a copy of the /source/ to the /destination/

    I want the source to mirror the destination. I'm just not sure what cron command I need to make it happen.


    thanks,
    Jerry

  2. #2
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    8,897
    Mentioned
    138 Post(s)
    Tagged
    2 Thread(s)
    rm -rf /path/to/destination/* && cp -r /path/to/source/* /path/to/destination/
    Rémon - Hosting Advisor

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  3. #3
    SitePoint Member
    Join Date
    Jun 2013
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ScallioXTX View Post
    rm -rf /path/to/destination/* && cp -r /path/to/source/* /path/to/destination/
    thank you ScallioXTX. I really appreciate it and just wish I had asked on here first. I spent hours looking for the answer to this.


Tags for this Thread

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
  •