Parsing Directory Structure

F

fpetrucci007

Using access and builtin vb code, I need to parse through a directory tree
looking for folders that have more than 5 MB worth of data in them. Then
write out these directories to a text file. Any help would be appreciated.
Thanks
 
P

Peter Martin

Try this
Public Function fpath(path As String, minsize As Long) As String

Dim fso As New Scripting.FileSystemObject

Dim f As Folder, sf As Folder, fl As File
Set f = fso.GetFolder(path)
'Iterate through subfolders.
For Each sf In f.SubFolders
For Each fl In sf.Files
If fl.Size > minsize Then Debug.Print sf.Name, fl.Name, fl.Size
Next fl
Next
Set fl = Nothing
Set sf = Nothing
Set f = Nothing
Set fso = Nothing

End Function

HTH

Peter.
 
Top