Linux API - EXT3 文件信息
我正在写备份软件。我想以编程方式确定文件自上次以来是否已被修改。 EXT3 文件系统下的文件上是否有标志或类似的东西?
I'm writing backup software. I want to programmatically determine if a file has been modified since last time. Is a flag or something like that on files under the EXT3 filesystem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当然。只需对文件调用
stat()
并检查st_mtime 成员:如果应用程序中有上次备份时的时间戳,则可以直接进行比较。
但请注意,并非所有文件系统都会真正更新修改时间,因为这样做的成本很高。您似乎意识到了这种风险。
Sure. Just call
stat()
on the file, and inspect the st_mtime member:If you have in the application a timestamp when the last backup was made, you can compare directly.
Note though that not all filesystems really update the modified time, as doing so is kind of expensive. You seem to be aware of this risk.
我认为您正在寻找
stat()
I think you are looking for
stat()