Ramin
Jan 18th, 2000, 12:52 AM
Hi,
Is there anyway to use the "SetAttr" statement to change the attributes using "*.*"?
Please advice.
Aaron Young
Jan 18th, 2000, 02:58 AM
You could write your own Wrapper Sub which has the Extended Capability of handling WildCards, ie.
Public Sub SetAttrEx(ByVal PathName As String, ByVal Attributes As VbFileAttribute)
Dim sDir As String
Dim sPath As String
Dim iPos As Integer
While InStr(iPos + 1, PathName, "\")
iPos = InStr(iPos + 1, PathName, "\")
Wend
If iPos Then
sPath = Left$(PathName, iPos)
Else
sPath = PathName
End If
sDir = Dir(PathName)
While Len(sDir)
If (GetAttr(sPath & sDir) And vbDirectory) <> vbDirectory Then
Call SetAttr(sPath & sDir, Attributes)
End If
sDir = Dir
Wend
End Sub
Usage:
Same as SetAttr() but can also handle Wild Cards, ie.
Call SetAttr("C:\Files\*.txt", vbReadOnly)
------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
ajyoung@pressenter.com
Ramin
Jan 18th, 2000, 05:23 AM
Thank you very much for your reply.
Regards