The ASP Attributes Property is used for returning or setting the attributes of the specified file or folder. The attributes are defined with the following numerical values:
- 0: Normal file
- 1: Read-only file
- 2: Hidden file
- 4: System file
- 6: Folder or directory
- 32: The file has changed since the last backup
- 1024: Link or shortcut
- 2048: Compressed file
Syntax:
Parameters: This property has a single parameter as mentioned above and described below:
- newattributes: It specifies the attributes that have to be set for the given file or folder. It is an optional attribute.
The below examples demonstrate the ASP Attributes Property.
Example 1: The below code returns the attributes of the file.
ASP
<%
dim fs,f
set fs=Server.CreateObject( "Scripting.FileSystemObject" )
'Getting the file
set f=fs.GetFile( "d:\GFG.txt" )
Response.Write( "The attributes of the file are: " )
'Getting the attributes of the file
Response.Write(f.Attributes)
set f=nothing
set fs=nothing
%>
|
Output:
The attributes of the file are: 1024
Example 2: The below code returns the attributes of the folder.
ASP
<%
dim fs,folder
set fs=Server.CreateObject( "Scripting.FileSystemObject" )
'Getting the folder
set folder=fs.GetFolder( "d:\geeks" )
Response.Write( "The attributes of the folder are: " )
'Getting the attributes of the folder
Response.Write(folder.Attributes)
set folder=nothing
set fs=nothing
%>
|
Output:
The attributes of the folder are: 18
Last Updated :
24 Mar, 2021
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...