Cron job to delete files created before a specific time

I have this cron job to empty a temp folder I have once a day:

rm -rf /home/username/public_html/temp/*

I want this cron job to delete all files which created before the it will run with 5 minutes and up just to make sure that my script don't need these files anymore.

Let's say I set the cron job to run everyday at 10:00 AM .. I want it to delete all files in this folder which created before 09:55 AM

Thank you so much experts!

Answers


If you're using GNU find, try this:

find /home/username/public_html/temp -type f -mmin +5 -delete

Should also work with FreeBSD or many other versions of find.


Need Your Help

How does boost bind work behind the scenes in general?

c++ boost boost-bind

Without spending a long time reviewing the boost source code, could someone give me a quick rundown of how boost bind is implemented?

Constructing “introspective” nested html tables

perl recursion nested-table

This is something I'm writing using the Template Toolkit in Perl, but it's more a generic algorithm problem. My basic problem is that given a data structure like this:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.