Members of the Forum -
Here's what I have so far attempting to read some of the file times. I used
the function "CreateFileR" from "directio.ijs", which I found at
http://www.jsoftware.com/jwiki/Scripts/WindowsDirectIO, to get the file
handle which I need as an input to the "GetFileTime" API.
load 'c:\amisc\j\directio.ijs'
NB. See what modification time looks like:
dir flnm=. 'C:\amisc\pix\Photos\2009Q1\20090116\DSCF5118.JPG'
+------------+-----------------+-------+---+------+
|DSCF5118.JPG|2009 1 16 16 5 32|3091773|rw-|-----a|
+------------+-----------------+-------+---+------+
]fh=. CreateFileR
(flnm,{.a.);(FILE_ANY_ACCESS);(FILE_SHARE_READ+FILE_SHARE_WRITE);NULLPTR;OPEN_EXISTING;0;0
892
NB. Here's the definition of the kernel32 API to get file times:
getFileTimeDefn=. 0 : 0
BOOL WINAPI GetFileTime(
__in HANDLE hFile,
__out_opt LPFILETIME lpCreationTime,
__out_opt LPFILETIME lpLastAccessTime,
__out_opt LPFILETIME lpLastWriteTime
);
)
getFlTms=: 'GetFileTime' win32api NB. GetFileTime i i *i *i *i
]'rc hndl crt lat lwt'=. getFlTms fh;,&.>0;0;0
+-+---+---------+----------+---------+
|1|892|108052680|_800311242|718878208|
+-+---+---------+----------+---------+
q'' NB. Don't otherwise know how to release the file handle.
This seems to lose my file as well (it disappears) but I've saved a copy
elsewhere.
Now I open the file and save it to change the modification time, then re-do
the preceding:
dir flnm=. 'C:\amisc\pix\Photos\2009Q1\20090116\DSCF5118.JPG'
+------------+------------------+-------+---+------+
|DSCF5118.JPG|2009 1 18 21 46 50|2800305|rw-|-----a|
+------------+------------------+-------+---+------+
fh=. CreateFileR
(flnm,{.a.);(FILE_ANY_ACCESS);(FILE_SHARE_READ+FILE_SHARE_WRITE);NULLPTR;OPEN_EXISTING;0;0
]'rc hndl crt lat lwt'=. getFlTms fh;,&.>0;0;0
+-+---+---------+---------+---------+
|1|896|757188758|783595008|764845008|
+-+---+---------+---------+---------+
All these times (the latter three numbers) look completely different. What
gives? Shouldn't some of them remain the same?
Regards,
Devon
--
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm