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!

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:
    34
    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 Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,442
    Likes Received:
    1,961
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice