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.
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.
精彩评论