本文介绍了找到-mtime文件日期早1个多小时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这样的命令,我跑每24小时现。
I have this command that I run every 24 hours currently.
find /var/www/html/audio -daystart -maxdepth 1 -mtime +1 -type f -name "*.mp3" -exec rm -f {} \;我想运行它每隔1小时,并删除那些超过1个小时之前的文件。这是正确的:
I would like to run it every 1 hour and delete files that are older than 1 hour. Is this correct:
find /var/www/html/audio -daystart -maxdepth 1 -mtime **+0.04** -type f -name "*.mp3" -exec rm -f {} \;我不知道我使用十进制数??
I am not sure of my use of the decimal number??
感谢您的任何修改。
或可能我只是使用 -mmin 60 ?这是正确的?
OR could I just use -mmin 60? Is this correct?
我想你的测试,好东西你建议。我得到一个空的结果。我希望所有文件的前一封 60分钟相比要删除!我怎样才能做到这一点?请问我的命令真正做到这一点?
I tried your test, good thing you suggested it. I got an empty result. I want all files OLDER than 60mins to be deleted! How can I do this?? Does my command actually do this?
推荐答案关于 -mmin ?
find /var/www/html/audio -daystart -maxdepth 1 -mmin +59 -type f -name "*.mp3" \ -exec rm -f {} \;从人的发现:
-mmin n File's data was last modified n minutes ago.此外,确保先进行测试!
... -exec echo rm -f '{}' \; ^^^^ Add the 'echo' so you just see the commands that are going to get run instead of actual trying them first.更多推荐
找到
发布评论