Expanding File Folders

  • Thread starter Thread starter hharry
  • Start date Start date
H

hharry

Hello All,

I have a ListView control which displays files from a remote server.
Some ListViewItems are folders which have an undetermined number of
sub-folders.

What I need to do is programatically expand all folders/sub folders and
download the files within.

Has anybody coded a function which will loop thru a folder and all
subfolders ?

Thanks in advance
 
hharry,

This subprocedure loops through all the files and folders for a particular
starting folder:

Private Sub DisplayFolderInfo(ByVal folder As String)

Dim di As New DirectoryInfo(folder)
Dim fi As FileInfo

MsgBox("Folder: " & folder)

For Each fi In di.GetFiles
MsgBox("File: " & fi.FullName)
Next

Dim subDI As DirectoryInfo
For Each subDI In di.GetDirectories
DisplayFolderInfo(di.FullName & "\" & subDI.Name)
Next

End Sub

You get the process started like this:

DisplayFolderInfo("c:\TestDisplayFolders")

Kerry Moorman
 
hharry said:
I have a ListView control which displays files from a remote server.
Some ListViewItems are folders which have an undetermined number of
sub-folders.

How do you have access to the remote server?
 

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