Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Change file attribute
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00544743
Message ID:
00544778
Views:
18
>>>Hi people.
>>>How can i change file attribute from read only to write and back?
>>>Thank you
>>
>>Alex,
>>
>>There's a file in the Download section by Hank Fay (Get/Set File Attributes, I think it's called) that can do this. It can also be done via the Windows Script Host if it's available.
oFSO = CREATEOBJECT("Scripting.FileSystemObject")
>>oFile = oFSO.GetFile(lcfile) && lcfile is the name of the file
>>* Toggle the read-only bit
>>oFile.Attributes = BITXOR(oFile.Attributes, 1)
In the above example, if the attribute is not Read-Only the Read-Only bit will be set. Otherwise, it will be cleared.
>
>Hey, that is much better. So if you want to check the setting you would test with BITTEST()?

Yeppers, and you could use BITCLEAR() and BITSET().
George

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

Click here to load this message in the networking platform