Help! Make Cronjob to delete Files older than 3 hours in folder Every 35

Franc0

New Member
Messages
206
Reaction score
0
Points
0
I need a cronjob command to act every 35 minutes to delete all files older than 3 hours in a given directory

for example in directory


public_html/myfolder/files.

Can someone help me ? thanks so much i need this.
 

TechAsh

Retired
Messages
5,853
Reaction score
7
Points
38
This is the cron job I use:
find /home/username/directory/to/delete/files/from/* -mtime +7 -exec rm {} \;
But that deletes files older than 7 days. So try this:
find /home/username/directory/to/delete/files/from/* -mmin +180 -exec rm {} \;
 
Top