Reputation: 11836
In my app I create temp dirs every time user commits a certain action. Is there a chance to somwhow set 'expire' on that dirs? I need to delete those dirs exactly after hour since they were created.
I was thinking about CRONJOB but it will only run once an hour. This will not necessarily delete dirs exactly after one hour.
Thanks in advance.
Upvotes: 1
Views: 64
Reputation: 755054
You could use at
to schedule the removal of a particular directory. This has the advantage that even if you modify the directory after it is created (adjusting its modify time - the create time is not stored), you will get the correct directory removed. The granularity on at
is 1 minute.
Upvotes: 4