Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Cronjob to delete folders & files older than 3 days?

Discussion in 'General Discussion' started by fahl, Mar 28, 2018.

Tags:
  1. fahl

    fahl Active Member

    Joined:
    Jul 30, 2008
    Messages:
    31
    Likes Received:
    2
    Trophy Points:
    58
    I have 4 cameras that automatically store .jpg & .avi in seperate folders for each camera.
    I wish to use cron to delete folders & files after 3 days.
    Can someone please point me in right direction.
    Setup is folders


    ftpcam/cam1/cam2/cam3/cam4

    New daily folders are generated in these folders.

    I wish to delete all folders & files over 3 days in these folders.
    tried

    find /home/*****/public_html/ftpcam/{cam1,cam2,cam3,cam4}* -mtime +3 -exec rm {} \;

    But doesnt seem to work.
    Any help much appreciated

    Getting this error

    rm: cannot remove `/home/bumsrush/public_html/
    ftpcam/cam1/20180327': Is a directory
    rm: cannot remove `/home/*****/public_html/ftpcam/cam1/20180325': Is a directory
    rm: cannot remove `/home/*****/public_html/ftpcam/cam2/20180326': Is a directory
    rm: cannot remove `/home/*****/public_html/ftpcam/cam3/20180325': Is a directory
    rm: cannot remove `/home/*****/public_html/ftpcam/cam4/20180325': Is a directory
     
    #1 fahl, Mar 28, 2018
    Last edited by a moderator: Mar 28, 2018
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    42,734
    Likes Received:
    1,706
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page