Retrieve a file timestampTag(s): Powerscript
[structure] type os_filedatetime from structure unsignedlong ul_lowdatetime unsignedlong ul_highdatetime end type type os_finddata from structure unsignedlong ul_fileattributes os_filedatetime str_creationtime os_filedatetime str_lastaccesstime os_filedatetime str_lastwritetime unsignedlong ul_filesizehigh unsignedlong ul_filesizelow unsignedlong ul_reserved0 unsignedlong ul_reserved1 character ch_filename[260] character ch_alternatefilename[14] end type type os_systemdatetime from structure uint wYear uint wMonth uint wDayOfWeek uint wDay uint wHour uint wMinute uint wSecond uint wMillisecond end type [external function declaration] FUNCTION long FindFirstFileA & ( string filename, ref os_finddata findfiledata) & LIBRARY "KERNEL32.DLL" FUNCTION boolean FindClose (long handle) LIBRARY "KERNEL32.DLL" FUNCTION boolean FileTimeToLocalFileTime & ( ref os_filedatetime lpFileTime, ref os_filedatetime lpLocalFileTime) & LIBRARY "KERNEL32.DLL" FUNCTION boolean FileTimeToSystemTime & (ref os_filedatetime lpFileTime, ref os_systemdatetime lpSystemTime) & LIBRARY "KERNEL32.DLL" [powerscript] os_FindData lstr_FindData os_FindData lstr_FindDataTemp os_SystemDatetime lstr_SystemDateTime long handle String ls_timestamp handle=FindFirstFileA & ("C:\Program Files\Sybase\PowerBuilder 9.0\pb90.exe", lstr_FindData) IF handle=-1 THEN // something wrong! ELSE FindClose(handle) FileTimeToLocalFileTime & (lstr_FindData.str_lastwritetime, lstr_FindDataTemp.str_lastwritetime) IF FileTimeToSystemTime & (lstr_FindDataTemp.str_lastwritetime, lstr_SystemDateTime) THEN ls_timestamp = string & (datetime(date(lstr_SystemDateTime.wYear, & lstr_SystemDateTime.wMonth, lstr_SystemDateTime.wDay), & time(lstr_SystemDateTime.wHour, & lstr_SystemDateTime.wMinute, lstr_SystemDateTime.wSecond)), & "mm/dd/yyyy hh:mm:ss") MessageBox("PB9", ls_timestamp) END IF END IF
FILE_ATTRIBUTE_READONLY 0x00000001 FILE_ATTRIBUTE_HIDDEN 0x00000002 FILE_ATTRIBUTE_SYSTEM 0x00000004 FILE_ATTRIBUTE_DIRECTORY 0x00000010 FILE_ATTRIBUTE_ARCHIVE 0x00000020 FILE_ATTRIBUTE_DEVICE 0x00000040 FILE_ATTRIBUTE_NORMAL 0x00000080 FILE_ATTRIBUTE_TEMPORARY 0x00000100 FILE_ATTRIBUTE_SPARSE_FILE 0x00000200 FILE_ATTRIBUTE_REPARSE_POINT 0x00000400 FILE_ATTRIBUTE_COMPRESSED 0x00000800 FILE_ATTRIBUTE_OFFLINE 0x00001000 FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000 FILE_ATTRIBUTE_ENCRYPTED 0x00004000
mail_outline
Send comment, question or suggestion to howto@rgagnon.com
Send comment, question or suggestion to howto@rgagnon.com