找到

编程入门 行业动态 更新时间:2024-10-10 19:19:00
本文介绍了找到-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.

更多推荐

找到

本文发布于:2023-11-27 15:34:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1638583.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!