SCCM
SCCM

Reputation: 11

Cronjob to delete specific files by extension after x mins

Ok so I need to make a cronjob that will delete all the .exe files from a specific directory in my cpanel account. my home folder is "/home/Name" the folder that contains the .exe files located at "/home/Name/public_html/Folder" I'd like to set it to delete all the .exe files there every x min, say 5 mins. Thanks a lot in advance.

Upvotes: 0

Views: 1567

Answers (2)

Tomasz Jakub Rup
Tomasz Jakub Rup

Reputation: 10680

Enter to the cpanel and go to Home » Server Configuration » Configure cPanel Cron Jobs

Enter the following values:

  • Minute: */5
  • Hour: *
  • Day: *
  • Month: *
  • Weekday: *

In the Command text box enter: rm -rf /home/Name/public_html/Folder/*.exe

The following steps are equivalent to crontab field:

*/5 * * * * rm -rf /home/Name/public_html/Folder/*.exe

Upvotes: 2

SANBI samples
SANBI samples

Reputation: 2118

In your Linux terminal type:

sudo crontab -e

and following the instructions in the file that gets opened.

Upvotes: 0

Related Questions