File date and time
Code below shows how to retrieve file date and time using native VFP commands or WSH. For Windows API based solution that also allows to set file date and time, see George Tasker's Windows Time hosted on UT
MSDN links:This is sample code. Add error handling and adjust to your requirements as necessary. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 * VFP - Last Modified only #DEFINE ccADIR_NAME 1 #DEFINE ccADIR_SIZE 2 #DEFINE ccADIR_DATE 3 #DEFINE ccADIR_TIME 4 #DEFINE ccADIR_ATTR 5 lcFileName = "test.txt" DIMENSION laFleInfo[1] = ADIR(laFleInfo, lcFileName) * Date and Time Modified ? "ADIR: ", laFleInfo[ccADIR_DATE], laFleInfo[ccADIR_TIME] * Date Modified ? "FDATE: ", FDATE(lcFileName) * Time Modified ? "FTIME: ",FTIME(lcFileName) * DateTime Modified ? "FDATE,1: ", FDATE(lcFileName,1)
1 2 3 4 5 6 7 8 9 10 11 12 * WSH * Full path is required lcFileName = FULLPATH("test.txt") loFSO = CREATEOBJECT("Scripting.FileSystemObject") loFile = loFSO.GetFile(lcFileName) WITH loFile ? .DateLastModified, .DateCreated, .DateLastAccessed ENDWITH
Comments
WSH will not work on a 64 bit OS
Re: WSH will not work on a 64 bit OS
Works for my installation on
file date time identifier