获取在特定时间范围内已更改的所有文件 [英] Getting all files which have changed in specific time range
本文介绍了获取在特定时间范围内已更改的所有文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Bash中一个非常基本的问题,但我似乎无法弄清楚.我正在bash中寻找一个带有管道的衬板命令,该命令会在当前目录中找到所有上次在13:15到13:30之间更改的* .py文件(与日期无关).
A very basic question in Bash but I can't seem to figure it out. I'm looking for a one liner command with pipe, in bash which finds in the current directory all the *.py files which have changed last time between 13:15 until 13:30 (does not matter the date).
我想我可以使用 ls
和 cut
,但是我不确定这是否是写入格式.寻找使用基本命令"的方法.
I think I could use ls
and cut
but i'm not sure if it's the write format. looking for a use of the "basic commands".
推荐答案
使用查找
:
find . -maxdepth 1 -type f -name '*.py' -newermt "13:14:59.999" \! -newermt "13:30"
从下限时间 13:15
删除1毫秒,因此它包括 13:15:00
修改时间.
Remove 1 millisecond from the lower bound time 13:15
so it includes 13:15:00
modification time.
查找
参数明细:
-
.
:当前目录 -
-maxdepth 1
:不要下级子目录 -
-type f
:真实文件(无链接,目录,管道或设备...) -
-名称'* .py'
:其名称与模式*.py
匹配 -
-newermt"13:14:59.999"
:其修改时间在13:14:59.999
之后 -
\!-newermt"13:30"
:且修改时间不在13:30
之后
.
: current directory-maxdepth 1
: do not descend sub-directories-type f
: real files (no links or directories or pipes or devices...)-name '*.py'
: whose names match the pattern*.py
-newermt "13:14:59.999"
: whose modification time is after13:14:59.999
\! -newermt "13:30"
: and whose modification time is not after13:30
这篇关于获取在特定时间范围内已更改的所有文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文