Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting Folder Date
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00781126
Message ID:
00781155
Views:
16
>Hi,
>
>Does anybody know how can I set the DateLastModified property of a Folder?
>
>Regards,

Jose,

I have an application here in download section that can modify any of the three date/time values of a file. As is, it cannot do this to a folder. However, the modification is rather simple. The download includes several files. Open the file named FileIO.prg. First, add the following as the top of the file
#DEFINE FILE_FLAG_BACKUP_SEMANTICS 0x02000000
Second, change the line of code reading:
This.nFileHandle = CreateFile(@lcfilename, pnMode,;
  lnaccess, 0, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, 0)
to
IF NOT DIRECTORY(lcfilename, 1)
  This.nFileHandle = CreateFile(@lcfilename, pnMode,;
    lnaccess, 0, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, 0)
ELSE
  This.nFileHandle = CreateFile(@lcfilename, pnMode,;
    lnaccess, 0, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING + FILE_FLAG_BACKUP_SEMANTICS, 0)
ENDIF
this is in the OpenFile function of the of the class. Then to change the date last modified time stamp
SET PROCEDURE TO FileTime.prg
oTimes = CREATEOBJECT("FileTimes")
IF oTimes.SetFileTime("C:\Your_Dir\", , , DATETIME())
  * Success!
ENDIF
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform