Open In App
Related Articles

ASP size Property

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

The ASP size property is used to return the size of the specified file or folder. It returns the value in terms of bytes.

Syntax:

  • For file Object:
FileObject.Size 
  • For folder Object:
FolderObject.Size 

Example-1: Below code returns the size of a file. 

ASP

<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFile("d:\GFG.asp")
Response.Write("The size of GFG.asp is: ")
Response.Write(f.Size & " bytes.")
set f=nothing
set fs=nothing
%>

                    

Output:

The size of GFG.asp is: 100323 bytes.

Example-2: Below code returns a size of a folder.

ASP

<%
dim fs,fo
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fo=fs.GetFolder("d:\GFG")
Response.Write("The size of the folder test is: ")
Response.Write(fo.Size & " bytes.")
set fo=nothing
set fs=nothing
%>

                    

Output 

The size of the folder test is: 123456 bytes.

Last Updated : 31 Mar, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads