简体   繁体   English

如何在目录中递归查找文件修改的最新日期和时间?

[英]How to recursively find the latest date and time of file modification in directory?

I am aware of this related question . 我知道这个相关的问题

What I want is just the date and time of the last modification for any file inside a directory (recursively, the whole tree). 我想要的只是目录中任何文件的最后修改日期和时间(递归整个树)。 Is there any fast way to do this for large directories? 对于大型目录,有什么快速的方法吗?

Alternatively, I could also use a check telling me whether there was any modification after a given date. 或者,我也可以使用支票告诉我给定日期之后是否有任何修改。

To list the timestamp of all files in the folder : 要列出文件夹中所有文件的时间戳:

 find . -type f -printf '%t\n'

To get a unix timestamp : 要获取unix时间戳:

find . -type f -printf '%T@\n'

To list the timestamp of all files that were modified within the last 5 days 列出最近5天内修改的所有文件的时间戳

find . -type f -mtime -5 -printf '%t\n'

Note : all those commands are recursives 注意:所有这些命令都是递归的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM