I don't have a MAC but see if this code works. if it does I will modify it
to do what you want. The code gets size of all subfolders on the c drive and
put the info on a worksheet. I think for MAC's you have to change the
backshalsh ("\") to a colon (":") for it to work. I also was told that on
PC's for excel 2007 the filesearch was not included in excel 2007 but an
update added the function. I would also try going to Microsoft.com and
getting all the latest updates for excel and vista.
Dim RowNumber
Sub GetFolderSize()
strFolder = "C:"
RowNumber = 1
Set FSO = CreateObject _
("Scripting.FileSystemObject")
Set Folder = _
FSO.GetFolder(strFolder)
Sheets(1).Cells(RowNumber, 1) = strFolder + "\"
Sheets(1).Cells(RowNumber, 2) = Folder.Size
RowNumber = RowNumber + RowNumber
Call GetSubFolder(strFolder + "\")
End Sub
Sub GetSubFolder(strFolder)
Set FSO = CreateObject _
("Scripting.FileSystemObject")
Set Folder = _
FSO.GetFolder(strFolder)
If Folder.subfolders.Count > 0 Then
For Each sf In Folder.subfolders
On Error GoTo 100
Call GetSubFolder(strFolder + sf.Name + "\")
100 Next sf
End If
'folder size in bytes
On Error GoTo 200
For Each fl In Folder.Files
Sheets(1).Cells(RowNumber, 3) = fl.DateLastModified
Sheets(1).Cells(RowNumber, 2) = fl.Size
Sheets(1).Cells(RowNumber, 1) = strFolder & fl.Name
RowNumber = RowNumber + 1
Next fl
200 On Error GoTo 0
End Sub