Thuộc tính kích thước ASP
❮ Tham chiếu đối tượng thư mục hoàn chỉnh
Thuộc tính Size được sử dụng để trả về kích thước, tính bằng byte, của tệp hoặc thư mục được chỉ định.
Cú pháp
FileObject.Size
FolderObject.Size
Ví dụ cho đối tượng Tệp
<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFile("c:\test.asp")
Response.Write("The size of test.asp is: ")
Response.Write(f.Size & " bytes.")
set f=nothing
set fs=nothing
%>
Output:
The size of test.asp is: 10556 bytes.
Ví dụ cho đối tượng Thư mục
<%
dim fs,fo
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fo=fs.GetFolder("c:\test")
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.
❮ Tham chiếu đối tượng thư mục hoàn chỉnh