仅列出当前目录中超过x天的所有文件 [英] List all files older than x days only in current directory

查看:57
本文介绍了仅列出当前目录中超过x天的所有文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是unix的新手,在其他问题上无法获得适当的结果.

I am new to unix and couldn't get appropriate outcome in other questions.

我只想列出当前目录中早于x天的文件.我没有限制

I want to list only files in current directory which are older than x days. I have below restriction

  • 仅列出当前文件夹中早于30的文件天
  • 输出不应包含目录和子目录
  • 这应该列出类似于"ls"命令的文件
  • 输出应类似于 file1 file2 file3 ..

我使用了 find.-mtime +30 .但这也会在子目录中提供文件和文件.我想限制以递归方式进行搜索,而不是在目录内进行搜索.

I used find . -mtime +30. but this gives files and files in sub-directories as well. I would like to restrict doing search recursively and not to search inside directories.

非常感谢!

推荐答案

您可以使用 find.-maxdepth 1 排除子目录.

You can use find . -maxdepth 1 to exclude subdirectories.

这篇关于仅列出当前目录中超过x天的所有文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆