开发者

Linux API - EXT3 file information

I'm writing backup software. I want to programmatically determine if a file has been modified si开发者_C百科nce last time. Is a flag or something like that on files under the EXT3 filesystem?


Sure. Just call stat() on the file, and inspect the st_mtime member:

struct stat {
    /* ... snip ... */
    time_t    st_atime;   /* time of last access */
    time_t    st_mtime;   /* time of last modification */
    time_t    st_ctime;   /* time of last status change */
};

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.


I think you are looking for stat()

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜