About corn job to delete file command !

Discussion in 'Site & Server Administration' started by nickgo2, May 6, 2011.

  1. #1
    Hello
    I use cpanel to set corn job .
    I want to delete my website files in files folder .
    To delete file every 60 mins ......
    Now I set " find /home/rapid911/public_html/files/ -mmin +60 -exec rm {} \; "
    Does it right ?
    Please help me !
    Thanks !

     
    nickgo2, May 6, 2011 IP
  2. Intermg

    Intermg Active Member

    Messages:
    1,282
    Likes Received:
    11
    Best Answers:
    1
    Trophy Points:
    65
    #2
    The command line looks correct, but I would use -execdir instead of -exec for safety reasons. Before setting up a cron job, be sure to create a test directory, put some files there and run the command to see how it works.

    EDIT: you should enclose braces in single quote marks, like this:

    find /home/rapid911/public_html/files/ -mmin +60 -exec rm '{}' \;
     
    Last edited: May 6, 2011
    Intermg, May 6, 2011 IP
  3. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #3
    Bohra, May 8, 2011 IP