Getting number of files within a sub-folder and its size

H

Hari

Hi,

I have lots of files within numerous different folders.

What I want to do is know the number of files in each sub-folder folder
and the total size of each folder .

For example if my root folder is Folder1 and if it has 10 sub-folders
Folders. Then I want to know the size of each of those 10 sub-folders
and the number of *.wma files within each sub-folder.

I use the following (zliched) program in case I need to do some file
manipulation like opening or list of files etc. I dont know how to
modify this code to do the above process.

Sub ListRootFoldersWithinaPath()

Dim i As Integer

Dim wbnew As Workbook

Set wbnew = Workbooks.Add


With Application.FileSearch

.NewSearch
.LookIn = UCase("D:\My files")
.SearchSubFolders = True
.FileType = msoFileTypeAllFiles
.Execute

For i = 1 To .FoundFiles.Count

wbnew.Sheets(1).Cells(i, 1).Value = .FoundFiles(i)

Next i



End With

End Sub

Can somebody please guide me.

Regards,
HP
India
 
J

Jim Cone

HP,
You might want to give the free Excel add-in "List Files" a try.
It can look for *.wma files within a folder and sub-folders.
It will list the file name, path and folder size among other info.
Download from (no registration required)...
http://www.realezsites.com/bus/primitivesoftware
--
Jim Cone
San Francisco, USA


"Hari" <[email protected]>
wrote in message
Hi,
I have lots of files within numerous different folders.
What I want to do is know the number of files in each sub-folder folder
and the total size of each folder .
For example if my root folder is Folder1 and if it has 10 sub-folders
Folders. Then I want to know the size of each of those 10 sub-folders
and the number of *.wma files within each sub-folder.
I use the following (zliched) program in case I need to do some file
manipulation like opening or list of files etc. I dont know how to
modify this code to do the above process.

Sub ListRootFoldersWithinaPath()
Dim i As Integer
Dim wbnew As Workbook
Set wbnew = Workbooks.Add
With Application.FileSearch
.NewSearch
.LookIn = UCase("D:\My files")
.SearchSubFolders = True
.FileType = msoFileTypeAllFiles
.Execute
For i = 1 To .FoundFiles.Count
wbnew.Sheets(1).Cells(i, 1).Value = .FoundFiles(i)
Next i
End With
End Sub
Can somebody please guide me.
Regards,
HP
India
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top