ASP Type Property

Last Updated : 24 Mar, 2021

The ASP Type Property is used to return the type of the particular file or folder. It returns the complete name of the type of file or folder.

Syntax:

  • For File Object:

    FileObject.Type
  • For Folder Object:

    FolderObject.Type

The below examples demonstrate the ASP Type Property.

Example 1: 

ASP
<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")

'Getting the file
set f=fs.GetFile("d:\GFG.txt")
Response.Write("The file GFG.txt is of type: ")

'Getting the type of the file
Response.Write(f.Type)

set f=nothing
set fs=nothing
%>

Output:

The file GFG.txt is of type: Text Document

Example 2:

ASP
<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
  
'Getting the file
set f=fs.GetFile("d:\GFG.asp")
Response.Write("The file GFG.asp is of type: ")

'Getting the type of the file
Response.Write(f.Type)
  
set f=nothing
set fs=nothing
%>

Output:

The file GFG.asp is of type: Active Server Document

Example 3: The below code demonstrates the ASP Folder.Type Property.

ASP
<%
dim fs,fol
set fs=Server.CreateObject("Scripting.FileSystemObject")

'Getting the required folder
set fol=fs.GetFolder("d:\GFG")

'Getting the type of the folder
Response.Write("The type of the folder is: " & fol.Type)

set fol=nothing
set fs=nothing
%>

Output:

The type of the folder is: File folder
Comment