如何使用 C++ 在特定时间段内获取目录中修改的文件? [英] How can I get the files modified in a directory in a particular period of time using c++?

查看:34
本文介绍了如何使用 C++ 在特定时间段内获取目录中修改的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨在我开发的示例应用中,我想检索在特定时间段内修改的文件的详细信息.

Hi In a sample App I develop, I would like to retrieve the details of files modified in a particular time period.

或者简单地...我有时间陪我(比如 2011 年 6 月 6 日上午 10:00),并且想要获取在该特定时间之后修改的目录(比如 C:\MyFolder)中的文件列表.

Or simply... I have a time with me (say june 6th 2011 10:00 AM) and would like to get the list of files in a directory(say C:\MyFolder) which is modified after that partiicular time.

我试过一种方法..

   CFileFind finder;
   szFile = _T("C:\\MyFolder\\*.*");
BOOL bFound = finder.FindFile( szFile );
CTime fileTime;
CTime fileCreateTime;
while ( bFound )
{
          bFound = finder.FindNextFile();
    finder.GetLastWriteTime(fileTime);
    finder.GetCreationTime(fileCreateTime);
    szFile = finder.GetFilePath();
    if((startTime < fileTime) || (startTime < fileCreateTime))
            {

                 ......

是否有其他可用的 windows api 或有比这更好的方法..?

Is there any other windows apis available for this or is there any better method than this..?

任何人请回复...

提前致谢....

推荐答案

不知道确切的 API,但我会从这里开始:http://msdn.microsoft.com/en-us/图书馆/aa363798(VS.85).aspx

Don't know the exact APIs, but I'd start here: http://msdn.microsoft.com/en-us/library/aa363798(VS.85).aspx

这篇关于如何使用 C++ 在特定时间段内获取目录中修改的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆