[英]Finding Files in Linux based on Modification TIme
假設在同一天修改/創建了文件,是否有辦法在Linux中獲取僅具有修改時間(例如大於5 am)的文件。
如果您有GNU find
則可以執行以下操作:
find . -name "*" -type f -newermt "2014-04-04 05:00:00"
從man
頁:
-newerXY reference將當前文件的時間戳與引用進行比較。 reference參數通常是文件名(其時間戳之一用於比較),但也可以是描述絕對時間的字符串。 X和Y是其他字母的占位符,這些字母選擇屬於參考的方式用於比較的時間。
a The access time of the file reference B The birth time of the file reference c The inode status change time of reference m The modification time of the file reference t reference is interpreted directly as a time Some combinations are invalid; for example, it is invalid for X to be t. Some combinations are not implemented on all systems; for example B is not supported on all systems. If an invalid or unsupported combination of XY is specified, a fatal error results. Time specifications are interpreted as for the argu‐ ment to the -d option of GNU date. If you try to use the birth time of a reference file, and the birth time cannot be deter‐ mined, a fatal error message results. If you specify a test which refers to the birth time of files being examined, this test will fail for any files where the birth time is unknown.
您可以找到在最后一天修改過的文件find / -type f -mtime -1
要么
## (year 2014 April day 05 time 05:00:00)
touch -t 201404040500.00 ~/myfile
## Find all files newer then myfile
find / -newer ~/myfile
希望能有所幫助
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.