CString Directory[2]={"D:\\报文备份\\PAT\\*.sql*","D:\\报文备份\\SRC\\*.src*"};
CTime FileCreateTime,CurrentTime;
CurrentTime=CTime::GetCurrentTime();
CTimeSpan TimeSpan;
int i=0;
while(i>=0&&i<2)
{
CFileFind finder;
BOOL bWorking = finder.FindFile(Directory[i++]);
while (bWorking)
{
bWorking=finder.FindNextFile();
if(finder.GetLastWriteTime(FileCreateTime))
{
TimeSpan=CurrentTime-FileCreateTime;
if (TimeSpan.GetDays()>=6)
{
CString FileName = (LPCTSTR)finder.GetFileName();
DeleteFile(FileName);
}
}
}
}
}
MFC 遍历文件
最新推荐文章于 2023-01-10 21:04:40 发布