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:
00781329
Views:
15
>>>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, something went wrong and I started to trace your code. First of all, testing if the first parameter was a directory was not working. There is no second parameter in DIRECTORY(). At least in VFP7.
>After fixing this problem I tried to use the function and it´s not working, because it could not open the folder. It´s working ok with files. Are you sure about CreateFile parameters?
>
>Regards,

Yep, I am. I'm using VFP 8.0. What version of VFP are you using? If there's a difference in the parameters, this may be the cause.
George

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

Click here to load this message in the networking platform