Determining File Create / Modified Date

13 views
Skip to first unread message

Martin.B...@hse.gsi.gov.uk

unread,
Feb 6, 2012, 10:45:22 AM2/6/12
to openroa...@googlegroups.com
All,

I am in the process of developing an eClient application that will use
the Load'n'Run technology for distribution. As part of the application,
the are several Word & Excel templates that are used for generating
reports. When the application is downloaded to the client all the files
are initially placed in the II_ECLIENT_APPDIR directory. In order to
run the templates, they need to be copied to the user's template folder
(APPDATA\microsoft\templates) - to allow macros to be executed.

I can do this the first time the application is run based on the files
being missing. However, if the templates are modified, and so
re-downloaded to the II_ECLIENT_APPDIR folder, this check will not cause
them to be copied to the template folder. I was thinking of comparing
the files creation dates and copying if the ECLIENT folder version of
the file is newer. However, I am not sure how to access the various
dates of a file from OpenROAD.

Does anyone know how to do this, or have an alternative solution?
Ideally, I do not want to simply copy the templates every time the
application is run as this seems rather wasteful.

Many thanks,
Martin Bloomfield.
_________________________________________________
Application Developer & Database Administrator
IT Branch
Chemicals Regulation Directorate
Health and Safety Executive
YORK
Email: martin.b...@hse.gsi.gov.uk
Website: www.pesticides.gov.uk <http://www.pesticides.gov.uk/>
www.hse.gov.uk <http://www.hse.gov.uk/>
P Save a tree... please don't print this e-mail unless you really need
to

*****************************************************************************************************************
Please note : Incoming and outgoing email messages are routinely monitored for compliance with our policy on the use of electronic communications and may be automatically logged, monitored and / or recorded for lawful purposes by the GSI service provider.

Interested in Occupational Health and Safety information?
Please visit the HSE website at the following address to keep yourself up to date

www.hse.gov.uk

*****************************************************************************************************************

The original of this email was scanned for viruses by the Government Secure Intranet virus scanning service supplied by Cable&Wireless Worldwide in partnership with MessageLabs. (CCTM Certificate Number 2009/09/0052.) On leaving the GSi this email was certified virus free.
Communications via the GSi may be automatically logged, monitored and/or recorded for legal purposes.

da...@skybeam.plus.com

unread,
Feb 6, 2012, 4:55:16 PM2/6/12
to openroa...@googlegroups.com
Hi Martin,

One way of doing this in a Windows environment is to use KixStart scripting.
The GetFileTime would be part of the answer.
See http://www.kixtart.org

Regards
Dave

> --
> You received this message because you are subscribed to the Google Groups
> "OpenROAD Users Mailing List" group.
> To post to this group, send email to openroa...@googlegroups.com.
> To unsubscribe from this group, send email to
> openroad-user...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/openroad-users?hl=en.
>
>


Chris Clark

unread,
Feb 6, 2012, 5:31:58 PM2/6/12
to openroa...@googlegroups.com, Martin.B...@hse.gsi.gov.uk
A brute force (but less brute force than copying each and every time)
would be to use rsync, it can sync entire directories (be sure to avoid
the delete target flag).

Chris

On Monday 2012-02-06 14:28 (-0800), da...@skybeam.plus.com wrote:
> Hi Martin,
>
> One way of doing this in a Windows environment is to use KixStart scripting.
> The GetFileTime would be part of the answer.
> See http://www.kixtart.org
>
> Regards
> Dave
>
>
>
>> All,
>>
>> I am in the process of developing an eClient application that will use
>> the Load'n'Run technology for distribution. As part of the application,

>> the are several Word& Excel templates that are used for generating


>> reports. When the application is downloaded to the client all the files
>> are initially placed in the II_ECLIENT_APPDIR directory. In order to
>> run the templates, they need to be copied to the user's template folder
>> (APPDATA\microsoft\templates) - to allow macros to be executed.
>>
>> I can do this the first time the application is run based on the files
>> being missing. However, if the templates are modified, and so
>> re-downloaded to the II_ECLIENT_APPDIR folder, this check will not cause
>> them to be copied to the template folder. I was thinking of comparing
>> the files creation dates and copying if the ECLIENT folder version of
>> the file is newer. However, I am not sure how to access the various
>> dates of a file from OpenROAD.
>>
>> Does anyone know how to do this, or have an alternative solution?
>> Ideally, I do not want to simply copy the templates every time the
>> application is run as this seems rather wasteful.
>>
>> Many thanks,
>> Martin Bloomfield.
>> _________________________________________________

>> Application Developer& Database Administrator

Paul White

unread,
Feb 6, 2012, 5:59:59 PM2/6/12
to openroa...@googlegroups.com, Martin.B...@hse.gsi.gov.uk
Hi Martin,

Perhaps use WinAPI? Here is a link:
http://msdn.microsoft.com/en-us/library/aa364233(v=vs.85).aspx

I think one of these will do the trick
GetFileAttributesEx
WIN32_FILE_ATTRIBUTE_DATA

GetFileInformationByHandle
FILE_BASIC_INFO


I've come across problems relying on the timestamp in the past when
distributing components across a different time zone. And when daylight
savings kicks in, old files detect an hour difference.

You might consider managing a central list of templates with checksums. If a
change in checksum is detected, the component needs to be updated.
Somewhere around here I've got an OpenROAD / C integration which calculates
md5 hash on a piece of text. I'm sure there are better directory
synchronisation controls.

Paul

Kim Ginnerup

unread,
Feb 7, 2012, 6:24:37 AM2/7/12
to openroa...@googlegroups.com
Another solution could be:
If you distribute your templates from the server as part of the loadnrun client install.
You could bump the versionnumber everytime you change the templates.
The loadnrun installer wipes the appdir and recreate the content.
Then you'll know that if the files are present in the appdir they need to be moved.

Kim



-----Oprindelig meddelelse-----
Fra: openroa...@googlegroups.com [mailto:openroa...@googlegroups.com] På vegne af Martin.B...@hse.gsi.gov.uk
Sendt: 6. februar 2012 16:45
Til: openroa...@googlegroups.com
Emne: [openroad-users] Determining File Create / Modified Date
Reply all
Reply to author
Forward
0 new messages