Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
date and time, get newest (latest) from two dates
#1
I read in the following topic-link about using the '>' operator to get the newest file.
getfile newest

If I try it, it sometimes gives me the desired result and sometimes not.
(it's a bit strange, I can not explain why).

Does the below approach which I took, relates with the explanation in the link above?

Macro Macro4
Code:
Copy      Help
Dir dir_a
if dir_a.dir(source_pth 1)
,DateTime a=dir_a.TimeModified

Dir dir_b
if dir_b.dir(full_target_pth 1)
,DateTime b=dir_b.TimeCreated

if(dir(full_target_pth 1)&&dir(source_pth 1))
,if(a>b)
,,backup_or_restore="backup"
,if(a<b)
,,backup_or_restore="restore"


If the above approach is correct, then can I assume (?) that everything on the LEFT side of the > operator is newest (newest date/time).
So from the above example a would be the newest date in this situation ? :
Code:
Copy      Help
if(a>b)
#2
Quote:If the above approach is correct, then can I assume (?) that everything on the LEFT side of the > operator is newest (newest date/time).
Yes.
Sometimes Windows updates file properties not immediately. QM uses Windows API function FindFirstFile, you can read more there:
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
#3
Ok thanks, it's clear now!


Forum Jump:


Users browsing this thread: 1 Guest(s)