SoFunction
Updated on 2025-03-10

VBS tutorial: Attribute-Size Attribute

Size attribute

For a file, return the number of bytes for the specified file; for a folder, return the number of bytes for all files and subfolders in that folder.

object.Size

object should be the name of the File or Folder object.

illustrate

The following code shows how to use itFolderThe object'sSizeproperty:

Function ShowFolderSize(filespec)    Dim fso, f, s    Set fso = CreateObject("")    Set f = (filespec)s = UCase() & " Size is " &  & " byte。"ShowFolderSize = s End Function