Linux查找mtime和ctime不相等的文件

时间:2015-06-09 00:02:42

标签: linux shell ctime

我可以执行- (IBAction)save:(id)sender { STPCard *card = [[STPCard alloc] init]; card.number = self.paymentView.card.number; card.expMonth = self.paymentView.card.expMonth; card.expYear = self.paymentView.card.expYear; card.cvc = self.paymentView.card.cvc; [[STPAPIClient sharedClient] createTokenWithCard:card completion:^(STPToken *token, NSError *error) { if (error) { [self handleError:error]; } else { [self createBackendChargeWithToken:token]; } }]; } 并列出ctime和mtime不相等的文件吗?

find

MISSING_PART:类似于find . -type f -name '*.php' -ctime -5 MISSING_PART

1 个答案:

答案 0 :(得分:6)

这可以使用stat命令获得。 stat命令用于显示文件或文件系统状态。 -c选项用于指定此命令的输出格式。 %n格式用于指定文件名。 %Y用于指定自纪元以来的上次修改时间,%Z指定自纪元以来的最后一次更改时间。

命令find . -exec stat -c %n#%Y#%Z {} \; | awk -F# '{if ($2 != $3) print $1}'可用于提取更改时间和修改时间不相等的文件。

-ctime n的{​​{1}}和-mtime n选项是指find 小时前以来的上次更改或修改时间。此命令中未捕获此时间范围的概念。

相关问题