using FSO to get dir size?

Results 1 to 2 of 2

Thread: using FSO to get dir size?

  1. #1
    Join Date
    Dec 1969

    Default using FSO to get dir size?

    hello,<BR>i&#039;m trying to get the total size of a directoy.<BR>but i only know how to get the size of a sinle file,<BR>here&#039;s my script so far:<BR><BR>&#060;%<BR>&#039;--Function for MB<BR>Function bytesToMegs(number)<BR>dim bytes, megs<BR>bytes = number<BR>megs = bytes / 1000000<BR>megs = Round(megs,1)<BR>bytesToMegs = megs<BR>End Function<BR>&#039;-----------<BR>Set objFSO = Server.CreateObject("Scripting.FileSystemObject")< BR>tpath = Server.mapPath("/files/loop")<BR>Set objFile = objFSO.GetFile(tpath)<BR><BR>iFileSize = objFile.Size<BR>iFileSize = bytesToMegs(iFileSize)<BR><BR>response.write iFileSize<BR>%&#062;<BR><BR>now how can i use this to get the total size of a directory?<BR><BR>thanks in advance for your time!

  2. #2
    Join Date
    Dec 1969

    Default RE: using FSO to get dir size?

    Set objFolder = objFSO.GetFolder(tpath)&#039;tpath is the path to your folder<BR><BR>iFolderSize = objFolder.Size<BR>iFolderSize = bytesToMegs(iFolderSize)<BR><BR>response.write iFolderSize<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts