在特定目录中查找时间超过x时间的文件,而忽略子目录

Noosrep

我的设置如下:

文件夹结构

dir
 |--correctfile1
 |--correctfile2
 |--correctfile3
 |--subdir1
   |--wrongfile1
   |--wrongfile2
   |--wrongfile3
 |--subdir2
 |--subdir3

我需要找出其中是否有dir3分钟以上的文件这意味着我应该忽略文件夹,subdir1, subdir2 and subdir3而只在主目录中搜索dir

我有以下一线

find $dir -mmin +3 -type f

但这也会打印subdir1中的文件

一些额外的信息:

AIX 5.3

find命令不能有-maxdepth-mindepth-or-not-path选择


手册页:http : //textuploader.com/oe0r

豪克

一种防止find递归的可移植方法是对-prune除顶级目录之外的其他目录执行操作。

find "$dir" \! -name "$(basename -- "$dir")" -type d -prune -o -mmin +3 -type f -print

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章