Skip to content
⌘ NSIS Forum Archive

Getting File Last Modified Date

9 posts

Sailo#

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?
Joost Verburg#
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
kichik#
Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.


Search the forum please...
Sailo#
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
kichik#
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.
Sailo#
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?
brainsucker#
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... 🙂