[wpkg-users] [Bug 147] RFE: add file check against "last modified", "last accessed", and "creation" time,
bugzilla-daemon at bugzilla.wpkg.org
bugzilla-daemon at bugzilla.wpkg.org
Thu Sep 15 23:21:59 CEST 2011
http://bugzilla.wpkg.org/show_bug.cgi?id=147
Rainer Meier <r.meier at wpkg.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |r.meier at wpkg.org
Resolution| |FIXED
--- Comment #1 from Rainer Meier <r.meier at wpkg.org> ---
This is quite an old report. Specifically time/date handling is pretty
difficult usually. In WSH the time/date parser isn't really advanced and
supports only partial/simplified ISO 8601 format.
However WPKG implements an almost complete ISO 8601 parser used already for
installdate/uninstalldate parsing.
I've implemented file creation, modification and acccess time checks including
support for relative dates (minute resolution) as well as some shorthand tags
for yesterday, last week, last month and last year.
Here's a full change log:
FIX: Fixed bug in XSD. Packages do not have installdate/uninstalldate
attributes. Instead this attribute is supported within a package-
assignment in the profile only. Moved attribute from package to profile.
FIX: Fixed bug that quiet mode was always on by default (should default to off)
and therefore debug messages were sent to event log.
Thanks to Heiko Helmle for reporting.
NEW: Added file date comparison operations to checks. Basically you can compare
- file creation date
- file modification date
- file access time
You can compare the date to a date string passed in the value attribute or
compare to an existing file.
Basic syntax example:
<check type='file'
condition='datecreatenewerthan'
path='%SystemDrive%\test.txt'
value='@%SystemDrive%\test-comparison.txt' />
Valid conditions are:
- datemodifyequalto (Modify date equal to)
- datemodifynewerthan (Modify date newer than)
- datemodifyolderthan (Modify date older than)
- datecreateequalto (Create date equal to)
- datecreatenewerthan (Create date newer than)
- datecreateolderthan (Create date older than)
- dateaccessequalto (Access date equal to)
- dateaccessnewerthan (Access date newer than)
- dateaccessolderthan (Access date older than)
The 'value' attribute has to contain a string in the following format:
Relative timestamp (in minutes):
-100 Means the file timestamp is compared to the timestamp 100
minutes ago.
+50 Means the file timestamp is compared to the timestamp 50
minutes in the future.
Absolute timestamp in ISO 8601 format:
"2007-11-23 22:00" (22:00 local time)
"2007-11-23T22:00" (Both, "T" and space delimiter are allowed)
"2007-11-23 22:00:00" (specifies seconds which default to 0 above)
"2007-11-23 22:00:00.000" (specifies milliseconds which default to 0)
It is allowed to specify the timezone as well:
"2007-11-23 22:00+01:00" (22:00 CET)
"2007-11-23 21:00Z" (21:00 UTC/GMT = 22:00 CET)
"2007-11-23 22:00+00:00" (21:00 UTC/GMT = 22:00 CET)
File-Comparison:
Prefix your value with the '@' character in order to point to a file to
which the timestamp of the file referred in path is compared.
Examples:
@%SystemRoot%\explorer.exe
@c:\myfile.txt
Special terms:
last-week Check afainst timestamp of exactly one week ago (7
days).
last-month Check afainst timestamp of exactly one month ago (30
days).
last-year Check afainst timestamp of exactly one year ago (365
days).
yesterday Check afainst timestamp of yesterday (24 hours ago).
Some more examples:
Check if file has been modified after 15th of September 2011 15:00:
<check type='file'
condition='datemodifywerthan'
path='%SystemDrive%\test.txt'
value='2011-09-15T15:00' />
Check if file has been accessed within the last week:
<check type='file'
condition='dateaccessnewerthan'
path='%SystemDrive%\test.txt'
value='last-week' />
Check if file is older than one day (24 hours):
<check type='file'
condition='datecreateolderthan'
path='%SystemDrive%\test.txt'
value='yesterday' />
Check if file is older than 12 hours (720 minutes)
<check type='file'
condition='datecreateolderthan'
path='%SystemDrive%\test.txt'
value='-720' />
Implements change requested in Bug 147.
Thanks to Jason Oster.
WPKG 1.2.1-RC19 can be fetched from SVN as usual:
<http://wpkg.svn.sourceforge.net/viewvc/wpkg/wpkg/stable/1.2/>
br,
Rainer
--
Configure bugmail: http://bugzilla.wpkg.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
More information about the wpkg-users
mailing list