开发者

Delete directory exactly after hour since it was created

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜