Archive: Getting File Last Modified Date


Getting File Last Modified Date
I basically want to get a files last modified date and get the current date and compare the 2.

If the last modified date is more than a month ago i want to delete the file.

Has anybody got any ideas as to how to do this?


You can use GetFileTime to get the last modified date of a file. To get the current date have a look here: http://forums.winamp.com/showthread....threadid=70281


How do i use GetFileTime? Whats the high and low dwords?


http://forums.winamp.com/showthread....ight=file+time

Search the forum please...


I have searched and am still no closer.

I have the 2 dword values which don't mean a deal to me and i can get the current date using rainwaters dll.

How do i compare these?

Sorry if i'm missing something obvious


Rainwater's DLL won't give you the same format as GetFileTime so create another file, get it's time, which is the current time because you created it now, and compare.

Use the script in the link I gave you above to compare the two.


Right ok got it now. Sorry i got mislead.


I want to check if a file is older than a month or not.

If i create a new file it will have todays date on it so how do i minus a month of it?


last modified
These dwords, when combined represent "64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC)." [MSDN ;)]

So, 100 nanos intervals => 1 second contains 10000000 such intervals.
Just multiply by 60*60*24*30 to receive average month length :) The only problem should be 64-bit calculations... :)