Author Topic: IFolder.Size Property  (Read 2769 times)

0 Members and 1 Guest are viewing this topic.

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2524
  • User-Rate: +209/-0
  • Gender: Male
IFolder.Size Property
« on: July 14, 2008, 12:31:47 AM »

The following code illustrates the use of the Size property with a Folder object:

JScript

Code: [Select]
function ShowFolderSize(filespec)
{
   var fso, f, s;
   fso = new ActiveXObject("Scripting.FileSystemObject");
   f = fso.GetFolder(filespec);
   s = f.Name + " uses " + f.size + " bytes.";
   return(s);
}

VBScript

Code: [Select]
Function ShowFolderSize(filespec)
   Dim fso, f, s
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.GetFolder(filespec)
   s = UCase(f.Name) & " uses " & f.size & " bytes."
   ShowFolderSize = s
End Function

PowerBASIC

Code: [Select]
FUNCTION ShowFolderSize (BYVAL filespec AS STRING) AS STRING

   LOCAL fso AS IFileSystem
   LOCAL f AS IFolder
   LOCAL s AS STRING
   LOCAL v AS VARIANT
  
   fso = NEWCOM "Scripting.FileSystemObject"
   f = fso.GetFolder(UCODE$(filespec))
   v = f.Size
   s = ACODE$(f.Name) & " users " & STR$(VARIANT#(v)) & " bytes."
   FUNCTION = s

END FUNCTION
« Last Edit: March 10, 2010, 07:25:32 AM by José Roca »