开发者

Search for file by creation Time

I'm trying to write C++ code in windows to find a file by creation time, not by name of file. Can't seem to find anything. Any h开发者_StackOverflow社区elp or suggestions are welcome.


If you are looking for files that are under 20 seconds old, searching the whole tree could take longer than that.

If you are looking for files that were created while your program is running, you could use ReadDirectoryChangesW to wait for notifications of file changes with a filter of either FILE_NOTIFY_CHANGE_FILE_NAME or FILE_NOTIFY_CHANGE_CREATION.

If your program is looking for changes that happened shortly before it started up, you could use the somewhat more complicated change journal API. You would want to use FSCTL_READ_USN_JOURNAL with a filter value of USN_REASON_FILE_CREATE.


If you are using FindFirstFile and FindNextFile to walk through directories, the file creation times are in the WIN32_FIND_DATA structure.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜