Sunday, April 26, 2009

Get Size of Folder/File

Hi All,

Here iam providing a simple way of finding the size of required folder/file.
Try the below code & implement the same wherever & whenever applicable/required.

' Get the size of folder:
dim fso
foldername="Sreekanth"
Set fso = CreateObject( "Scripting.FileSystemObject" )
Set folder1 = fso.GetFolder( "D:\Documents and Settings\Sree\Desktop\"&foldername)
msgbox "Size of Folder "&foldername&" :- "&folder1.Size&" bytes"
Set fso=Nothing
' Output :











' Get the size of file:
Set fso = CreateObject( "Scripting.FileSystemObject" )
fname="qtpinf"
Set folder1 = fso.Getfile("D:\Documents and Settings\Sree\Desktop\"&fname&".doc")
msgbox "Size of File "&fname&" :- "&folder1.Size&" bytes"
Set fso=Nothing

' Output :






No comments:

Post a Comment