How to determine if a folder is read-only...


Author
Message
Trent Taylor
Trent Taylor
StrataFrame Developer (36K reputation)StrataFrame Developer (36K reputation)StrataFrame Developer (36K reputation)StrataFrame Developer (36K reputation)StrataFrame Developer (36K reputation)StrataFrame Developer (36K reputation)StrataFrame Developer (36K reputation)StrataFrame Developer (36K reputation)StrataFrame Developer (36K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Yup...Greg nailed it! Smile
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (11K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
The attributes property is a bitwise flag, so you actually want to use something like this:

Dim myDirectory As New System.IO.DirectoryInfo("C:\TEMP")

If (myDirectory.Attributes And System.IO.FileAttributes.ReadOnly) = System.IO.FileAttributes.ReadOnly Then

' Add your code here.

End If

StarkMike
StarkMike
StrataFrame VIP (2.2K reputation)StrataFrame VIP (2.2K reputation)StrataFrame VIP (2.2K reputation)StrataFrame VIP (2.2K reputation)StrataFrame VIP (2.2K reputation)StrataFrame VIP (2.2K reputation)StrataFrame VIP (2.2K reputation)StrataFrame VIP (2.2K reputation)StrataFrame VIP (2.2K reputation)
Group: Forum Members
Posts: 436, Visits: 944
Thanks!
Edhy Rijo
E
StrataFrame VIP (14K reputation)StrataFrame VIP (14K reputation)StrataFrame VIP (14K reputation)StrataFrame VIP (14K reputation)StrataFrame VIP (14K reputation)StrataFrame VIP (14K reputation)StrataFrame VIP (14K reputation)StrataFrame VIP (14K reputation)StrataFrame VIP (14K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi,

Try the following code:

Dim myDirectory As New System.IO.DirectoryInfo("C:\TEMP")

If myDirectory.Attributes = System.IO.FileAttributes.ReadOnly Then

     ' Add your code here.

End If



Edhy Rijo

StarkMike
StarkMike
StrataFrame VIP (2.2K reputation)StrataFrame VIP (2.2K reputation)StrataFrame VIP (2.2K reputation)StrataFrame VIP (2.2K reputation)StrataFrame VIP (2.2K reputation)StrataFrame VIP (2.2K reputation)StrataFrame VIP (2.2K reputation)StrataFrame VIP (2.2K reputation)StrataFrame VIP (2.2K reputation)
Group: Forum Members
Posts: 436, Visits: 944
I cant seem to figure out how to determine if a folder is read-only through VB .NET. Any help? Thanks
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search