How i can make this

Discussion in 'Site & Server Administration' started by fgsg, Feb 3, 2010.

  1. #1
    So how i can make example on my server i have DOWNLOADS folder and i need make something like automatic delete all files in this folder every 12 hours ? thx
     
    fgsg, Feb 3, 2010 IP
  2. fabriciogr

    fabriciogr Active Member

    Messages:
    958
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    73
    #2
    the question is to vague. you can do this a number of ways. you can make a php script that goes off every 12 hours and deletes those files, you can make a shell script that does the same.

    are these files been downloaded onto your tmp folder? if so then you can configure the server to empty the temp folder every 12 hours also.
     
    fabriciogr, Feb 3, 2010 IP
  3. Rudolf Bodocsi

    Rudolf Bodocsi Peon

    Messages:
    69
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi,

    Do you have shell access?
    Which operating system running on server?

    Rudolf
     
    Rudolf Bodocsi, Feb 4, 2010 IP
  4. slacker8

    slacker8 Peon

    Messages:
    176
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    in /etc/crontab add something like this line:

    0   */12  * * *  root    /bin/rm -rf /path/of/DOWNLOADS/*
    Code (markup):
    Obviously change "/path/of/DOWNLOADS/*"
     
    slacker8, Feb 4, 2010 IP
  5. fgsg

    fgsg Well-Known Member

    Messages:
    275
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #5
    First thx to all for help!

    @fabriciogr

    In my DOWNLOADS folder is video which my users convert from youtube and now i need make something what will delete this video every 12 h


    @slacker8

    So i need in Notead put 0 */12 * * * root /bin/rm -rf /path/of/DOWNLOADS/*
    and where upload this ? thx
     
    fgsg, Feb 4, 2010 IP
  6. RHS-Chris

    RHS-Chris Well-Known Member

    Messages:
    1,007
    Likes Received:
    35
    Best Answers:
    10
    Trophy Points:
    150
    #6
    You would need to place this in the crontab. Depending on your system, you would use something like this, from a shell command line:

    crontab -e

    Then, you would place that code in the bottom, hit ctrl x to save.
     
    RHS-Chris, Feb 4, 2010 IP