aflat362
asked on
Move Files older than x minutes to another directory
Hello,
I haven't touched C++ in a while and I'd like to get back into it. I'm now using VC++ 6.0 (a new compiler to me).
I would like to know how I would move all files in directory A to directory B (windows 2000 computer - program run locally) that are older than 5 minutes.
Thanks!
I haven't touched C++ in a while and I'd like to get back into it. I'm now using VC++ 6.0 (a new compiler to me).
I would like to know how I would move all files in directory A to directory B (windows 2000 computer - program run locally) that are older than 5 minutes.
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I guess I don't really know what MFC is. All I know is i'm using visual C++ 6 and I created a new console application and have one .cpp source code file. Sorry - Like I said VC++ 6 is a new tool to me. I understand what your code is doing for the most part and I might be able to figure the problem out from that
CFileFind ff;
CTime start_time = CTime::GetCurrentTime(); // Get the start time
if(ff.FindFile("c:\\*.*"))
{
BOOL result;
do
{
result = ff.FindNextFile();
CTime creation_time;
ff.GetCreationTime(creatio
if((start_time - creation_time).GetTotalMin
{
CString new_file_name = "c:\\backup\\" + ff.GetFileName();
MoveFileEx(ff.GetFilePath(
}
} while(result);
}