Page 1 of 1 1
Topic Options
#48294 - 1999-10-05 03:42 PM Check to see if file is more than 2 weeks old
Anonymous
Unregistered


I am trying to figure out how to check to see if a file is more than 2 weeks old. How do I convert date and filedate into something that I can do math on?

------------------

Top
#48295 - 1999-10-05 04:26 PM Re: Check to see if file is more than 2 weeks old
Anonymous
Unregistered


I think I resolved my own issue. Here is my solution. Please give it a look and let me know if you see something that won't work.

gets $thefile
$tt = getfiletime ($thefile)

$FileDate = substr($tt,1,10)
? $FileDate

$FileYear = val(substr($tt,1,4))
$FileMonth = val(substr($tt,6,2))
$FileDate = val(substr($tt,9,2))

$NowYear = @year
$NowMonth = @monthno
$NowDate = @mdayno

If $FileYear <> $NowYear
$NowMonth = $NowMonth + (12 * ($NowYear - $FileYear))
Endif

If $FileMonth <> $NowMonth
$NowDate = $NowDate + 30
Endif

If ($NowDate - $FileDate) > 15
? "File older than 2 weeks"
Else
? "File newer than 2 weeks"
Endif

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Henriques) and 2516 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.049 seconds in which 0.025 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org