Click to See Complete Forum and Search --> : Delete a File


iamlp
March 21st, 2001, 04:40 PM
Hello,
Anybody know how to delete a 'Read Only File' using VB. I tried Kill and it failed. Solution I have is to use shell("delete /F <Filename>").
Any other suggestions??

John G Duffy
March 21st, 2001, 06:28 PM
Try turning off the ReadOnly attribute bit first then "Kill"ing it

private Sub Command1_Click()
Dim MyFile
MyFile = "C:\Vb stuff/things to look at\Daily.ctl"
SetAttr MyFile, GetAttr(MyFile) And (255 - vbReadOnly)
End Sub




should clear its attributes

John G