我的设置如下:
文件夹结构
dir
|--correctfile1
|--correctfile2
|--correctfile3
|--subdir1
|--wrongfile1
|--wrongfile2
|--wrongfile3
|--subdir2
|--subdir3
我需要找出其中是否有dir
3分钟以上的文件。这意味着我应该忽略文件夹,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] 删除。
我来说两句