How can I get the files modified in a directory in a particular period of time using c++?

喜欢而已 提交于 2020-01-25 03:20:09

问题


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

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.

I have tried a method..

   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))
            {

                 ......

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

any one please reply...

Thanks in advance....


回答1:


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



来源:https://stackoverflow.com/questions/6248474/how-can-i-get-the-files-modified-in-a-directory-in-a-particular-period-of-time-u

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!