find-command:搜索创建时间 [英] find-command: search with created time
问题描述
如何找到创建7月30日04:37的东西并将其移动到/ tmp?有什么问题:
How can I find things created "Jul 30 04:37" and move them to /tmp? Something wrong:
find . -ctime "0037043007" -exec mv {} /tmp +
推荐答案
See the GNU find manual (and the time input formats information too).
特别地, -newerct '30 -Jul-2009 04:37'
选项似乎最多你想要的。
In particular, the -newerct '30-Jul-2009 04:37'
option seems to do most of what you want.
唯一的障碍是,该手册页意味着它适用于比给定时间更严格的文件。这表明您需要使用绝对时间:
The only snag is that the man page implies that it works for files strictly newer than given time. That suggests you need to use the absolute time:
1248957000 = 2009-07-30 05:30:00 (TZ = US/Pacific = UTC-07:00)
-newerct @1248957000
这仍然是如何处理严格超过语义的问题。
This still leaves the problem of how to deal with the strictly greater than semantics.
-newerct @1248956999 -a ! -newerct @1248957001
这是有效的,但是无可争议的凌乱(并假设你有工具来获取Unix时间戳从日期/时间值)。
This works, but is indisputably messy (and assumes you have tools to obtain the Unix timestamp from a date/time value).
您需要一个新的版本的 find
才能使其工作( GNU findutils 4.4.2是当前的)。
You need a new enough version of find
for this to work (GNU findutils 4.4.2 is current).
这篇关于find-command:搜索创建时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!