UNIX find:-newer选项的对面存在?

前端之家收集整理的这篇文章主要介绍了UNIX find:-newer选项的对面存在?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我知道有这个选项为unix的find命令:
  1. find -version
  2. GNU find version 4.1
  3.  
  4. -newer file Compares the modification date of the found file with that of
  5. the file given. This matches if someone has modified the found
  6. file more recently than file.

有一个选项,将让我找到比某个文件更旧的文件。我想删除目录中的所有文件以进行清理。所以,一个替代方案,我会发现所有的文件比N天还要做这个工作…

谢谢!

你可以使用!来否定这样的新操作:
  1. find . \! -newer filename

如果你想找到最后修改文件,然后7天前使用:

  1. find . -mtime +7

更新:

要避免与要比较的文件匹配,请使用以下命令:

  1. find . \! -newer filename \! -samefile filename

猜你在找的Bash相关文章