Skip to main content

Remove files via cronjob?

Comments

2 comments

  • rpvw
    You could use the following code, but it is important that you actually understand what it does and you don't just blindly copy and paste it ....... find /home/site/public_html/pics/files/ \( -name "*.zip" \) -type f -exec rm {} +
    Warning - this will also recursively loop through all the folders below the defined folder as well If you just want to limit the find to the configured folder use find /home/site/public_html/pics/files/ -maxdepth 1 \( -name "*.zip" \) -type f -exec rm {} +
    The best way of using this is to create a shell script and then call it by cron. If you don't have access to shell, you might want to explore using php to do the same thing See Cron Jobs - Version 74 Documentation - cPanel Documentation
    0
  • cPanelMichael
    Hello @graphicsarea, I concur with @rpvw here. Let us know if you have any additional questions. Thank you.
    0

Please sign in to leave a comment.