Cetin,
What if the directory is not empty?
Renoir
>>All,
>>
>>After solving the DLL puzzle (VFP goes poof upon CLEAR DLLS), that is the DLL turned out to be the troublemaker not VFP. I'm encountering a new problem.
>>
>>I'm storing a load of files to a temporary directory (using MKDIR). Next I zip the contents of this directory, I clear out the files and try to do a 'RMDIR C:\temp\it000003'. It fails with an access denied, in the Windows Explorer I can see that the directory is read-only.
>>So it's clear why it fails, but how to get past this. It seems the 'read-only' disappears upon closing the app or vfp, but that's too late. I need it done now.
>>
>>The directory is empty and it's not the current directory I'm trying to delete, so what's happening here??
>>Why can't I RMDIR?
>>
>>Thanks in advance for any suggestions.
>
>
>lcMyDir = 'c:\temp\Folderxx'
>SetFileAttr(lcMyDir)
>RmDir (lcMyDir)
>
>function SetFileAttr
>lparameters tcFileName, tlReadOnly, tlHidden, tlSystem
>
>#define FILE_ATTRIBUTE_READONLY 0x00000001
>#define FILE_ATTRIBUTE_HIDDEN 0x00000002
>#define FILE_ATTRIBUTE_SYSTEM 0x00000004
>
>local lnNewAttr
>lnNewAttr = iif(tlReadonly,FILE_ATTRIBUTE_READONLY,0)+;
> iif(tlHidden,FILE_ATTRIBUTE_HIDDEN,0)+;
> iif(tlSystem,FILE_ATTRIBUTE_SYSTEM,0)
>declare integer SetFileAttributes in Win32API ;
> string @ lpFileName, integer dwFileAttributes
>declare integer GetFileAttributes in Win32API ;
> string @ lpFileName
>
>SetFileAttributes(@tcFilename, ;
> bitor(bitand(GetFileAttributes(@tcFilename),0xFFFFFFF8),lnNewAttr))
>
Cetin