Parsing Directory Structure

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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.
 

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

Back
Top