我试图在我的计算机上找到创建特定文件前1小时和创建特定文件后1小时的文件。
这是我试过的方法 -
find /root -newermt "2012-10-04 1800" -and -newermt "2012-10-04 2000" -exec ls -ldb {} \;
我的linux上的目录是root,创建的特定文件是在19:00创建的
这是我尝试过的另一种方法,但是它只显示了之后或之前的两种结果! >
find /root/Downloads -type f \( -newer /root/Downloads/alex.txt ! -newer /root/Downloads/hesham.txt \)
答案 0 :(得分:2)
你想:
# missing a -not here ---------------------v
find /root -newermt "2012-10-04 1800" -and -not -newermt "2012-10-04 2000" -exec ls -ldb {} \;
这样做:
/root
答案 1 :(得分:1)
这可能不是最有效的解决方案,但是......
touch / tmp / temp -t文件创建时间 - 1小时
touch / tmp / ntemp -t文件创建时间+ 1小时
找到。 -newer / tmp / temp -a! -newer / tmp / ntemp -exec ls -l {} \; 2 - ;的/ dev / null的