123 Eng

Engineering the engineers™

Latest Jobs   Forum Map



Source Codes

Engineering Colleges

BE Students

Training  Reports (updated)

Seminar Reports (updated

Placement Papers (updated)


   Computer Science / IT






   CAT / MBA

   GMAT / Foreign MBA

Latest Jobs

Engineering Jobs / Technical Jobs

Management Jobs



Terms of use

Displaying  Source Code(s)  

SetAttr Statement


Description : The SetAttr statement sets the attributes of a file or folder. There are two
required arguments, pathname and attributes. Path name must be the absolute
path to a folder or file. The attributes argument is an integer representing
one of the following constants:

Constant Value
vbNormal 0

vbReadOnly 1

vbHidden 2

vbSystem 4

vbArchive 32

You must explicitly declare these constants in your code.

example usage:
Makes the directory New Folder On the C drive's root hidden.
<% SetAttr "C:New Folder", 2 %>

Makes the directory New Folder On the server's root hidden.
Const vbHidden = 2
SetAttr Server.MapPath("/New Folder"), vbHidden
source code:
Private Sub SetAttr(ByVal pathname, ByVal attributes)
Dim objFSO, objFile, objFolder, boolErr, strErrDesc
On Error Resume Next
Set objFSO = Server.CreateObject("scripting.filesystemobject")
If InStr( Right( pathname, 4 ), "." ) Then
' probably a file
Set objFile = objFSO.GetFile(pathname)
objFile.Attributes = attributes
Set objFile = Nothing
' probably a directory or folder
Set objFolder = objFSO.GetFolder(pathname)
objFolder.Attributes = attributes
Set objFolder = Nothing
End If
If Err Then
boolErr = True
strErrDesc = Err.description
End If
Set objFSO = Nothing
On Error GoTo 0
If boolErr Then Err.Raise 5103, "SetAttr Statement", strErrDesc
End Sub


Contribute content or training reports / feedback / Comments
job placement papers
All rights reserved copyright 123ENG