Jose,
>>>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.
>
>I´m using VFP7.
That's it then. I did the test for this under VFP 8.0. The additional parameter for the DIRECTORY() function is new. Did you include an ending backslash for the directory? That might be why CreateFile() isn't working.
The new parameter allows the DIRECTORY() function to return .T. if the directory exists, but is marked with either a hidden and/or system attribute. Without this flag, the function returns .F. if the attributes are hidden and/or system. This was the behavior in previous versions.
George
Ubi caritas et amor, deus ibi est