#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default 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





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pulling pdf files from general folder to specific folder [email protected] Excel Discussion (Misc queries) 2 September 8th 09 09:41 PM
How to decide folder-depth or How to select more folders/subfolders (folder-tree) ? Subteam Excel Discussion (Misc queries) 2 May 7th 06 08:14 PM
Need code to save file to new folder, erase from old folder Ron M. Excel Discussion (Misc queries) 1 February 24th 06 06:02 PM
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? Raven Excel Discussion (Misc queries) 1 January 24th 06 03:28 PM
I deleted 99% of data from excel file. Folder Size remains unchang msnut Excel Discussion (Misc queries) 2 September 21st 05 01:44 PM


All times are GMT +1. The time now is 03:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"