![]() |
Folder Size
Hi All,
I am trying to build a function that will output the total size (including sub-folders) of a directory? Is there a way of easily returning this information or would a loop be required? Ta Andi |
Folder Size
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 usage: ? Showfoldersize("C:\Data6") DATA6 uses 28409904 bytes. -- Regards, Tom Ogilvy "Andibevan" wrote in message ... Hi All, I am trying to build a function that will output the total size (including sub-folders) of a directory? Is there a way of easily returning this information or would a loop be required? Ta Andi |
Folder Size
Hi,
You will need a loop ... This VBA code should be useful for your problem (with a little modification :)): http://www.exceltip.com/st/List_file...Excel/446.html -- http://blog.jausovec.net "Andibevan" je napisal: Hi All, I am trying to build a function that will output the total size (including sub-folders) of a directory? Is there a way of easily returning this information or would a loop be required? Ta Andi |
Folder Size
Thanks Tom
"Tom Ogilvy" wrote in message ... 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 usage: ? Showfoldersize("C:\Data6") DATA6 uses 28409904 bytes. -- Regards, Tom Ogilvy "Andibevan" wrote in message ... Hi All, I am trying to build a function that will output the total size (including sub-folders) of a directory? Is there a way of easily returning this information or would a loop be required? Ta Andi |
All times are GMT +1. The time now is 09:12 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com