Click here to Skip to main content
15,895,656 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Finding files older than a week Pin
Viorel.21-Nov-06 1:37
Viorel.21-Nov-06 1:37 
AnswerRe: Finding files older than a week Pin
m.dietz21-Nov-06 3:57
m.dietz21-Nov-06 3:57 
QuestionRe: Finding files older than a week Pin
David Crow21-Nov-06 5:10
David Crow21-Nov-06 5:10 
AnswerRe: Finding files older than a week Pin
m.dietz21-Nov-06 20:23
m.dietz21-Nov-06 20:23 
AnswerRe: Finding files older than a week Pin
CPallini21-Nov-06 2:32
mveCPallini21-Nov-06 2:32 
GeneralRe: Finding files older than a week Pin
David Crow21-Nov-06 3:33
David Crow21-Nov-06 3:33 
GeneralRe: Finding files older than a week Pin
m.dietz21-Nov-06 4:04
m.dietz21-Nov-06 4:04 
GeneralRe: Finding files older than a week Pin
CPallini21-Nov-06 5:14
mveCPallini21-Nov-06 5:14 
Both of you have reason.

That stated, the following code works pretty well:

#include "stdafx.h"
#include <windows.h>
int main(int argc, char* argv[])
{
	OFSTRUCT ofs;
	if (argc <2) return -1;

	HFILE hFile;

	hFile = OpenFile(argv[1], &ofs, OF_READ);
	
	FILETIME ct, lat, lwt[2];


	SYSTEMTIME locTime;
	GetLocalTime(& locTime);

	BOOL  bSuccess= SystemTimeToFileTime( &locTime, &lwt[0]);

	bSuccess= GetFileTime( (HANDLE)hFile, &ct, &lat, &lwt[1]);
	
	LARGE_INTEGER li[2], liresult;

	li[0].LowPart = lwt[0].dwLowDateTime;
	li[0].HighPart = lwt[0].dwHighDateTime;


	li[1].LowPart = lwt[1].dwLowDateTime;
	li[1].HighPart = lwt[1].dwHighDateTime;

	liresult.QuadPart=li[0].QuadPart-li[1].QuadPart;

  if (liresult.QuadPart> 6048000000000L)
	{
		printf("more than a week\n");
	}


	
	CloseHandle((HANDLE)hFile);
	getchar();
	return 0;

}


The program compare the file given as its argument with the current system
time. I tested it.

What about your code? Maybe you're considering the wrong attribute (I don't believe you're modifying the files...)

Smile | :)
GeneralRe: Finding files older than a week Pin
m.dietz21-Nov-06 20:31
m.dietz21-Nov-06 20:31 
GeneralRe: Finding files older than a week Pin
CPallini21-Nov-06 21:51
mveCPallini21-Nov-06 21:51 
QuestionATL::CSimpleStringT ?? [modified] Pin
dharani20-Nov-06 23:25
dharani20-Nov-06 23:25 
AnswerRe: ATL::CSimpleStringT ?? Pin
Viorel.20-Nov-06 23:34
Viorel.20-Nov-06 23:34 
GeneralRe: ATL::CSimpleStringT ?? Pin
dharani20-Nov-06 23:37
dharani20-Nov-06 23:37 
GeneralRe: ATL::CSimpleStringT ?? Pin
Rajesh R Subramanian20-Nov-06 23:57
professionalRajesh R Subramanian20-Nov-06 23:57 
AnswerRe: ATL::CSimpleStringT ?? Pin
James R. Twine21-Nov-06 0:36
James R. Twine21-Nov-06 0:36 
QuestionArray Question Pin
Programm3r20-Nov-06 22:53
Programm3r20-Nov-06 22:53 
AnswerRe: Array Question Pin
Programm3r20-Nov-06 23:47
Programm3r20-Nov-06 23:47 
GeneralRe: Array Question Pin
toxcct21-Nov-06 0:29
toxcct21-Nov-06 0:29 
QuestionVS 2005 Express C++ code in header files!? Pin
floenk20-Nov-06 22:46
floenk20-Nov-06 22:46 
AnswerRe: VS 2005 Express C++ code in header files!? Pin
Christian Graus20-Nov-06 23:03
protectorChristian Graus20-Nov-06 23:03 
QuestionCtreeCtrl Popupmenu Pin
harsha_123420-Nov-06 22:45
harsha_123420-Nov-06 22:45 
AnswerRe: CtreeCtrl Popupmenu Pin
Mila02520-Nov-06 22:57
Mila02520-Nov-06 22:57 
GeneralRe: CtreeCtrl Popupmenu Pin
harsha_123420-Nov-06 23:09
harsha_123420-Nov-06 23:09 
GeneralRe: CtreeCtrl Popupmenu Pin
Mila02520-Nov-06 23:31
Mila02520-Nov-06 23:31 
GeneralRe: CtreeCtrl Popupmenu Pin
harsha_123421-Nov-06 1:03
harsha_123421-Nov-06 1:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.