>>>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)
>>* 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.
>Thank you all.
>I thought about FilesSystemObject, but i do not want to deal with intallation on
>a user's computer.I'd prefer to use API.
Also, check out the SetFileAttribute API entry here in the UT :
http://www.levelextreme.com/wconnect/wc.dll?FournierTransformation~2,31,Forum=0,18,94Coincidentally, the example shown is for setting the read-only flag to a file.
HTH