I'm trying to create my PackageManager and I wanted to implement the function to read / write the files contained in the subfolders. For now I can correctly read all files and folders in the root. How do I read the files in subfolders? This is the code I am using: Code: Dim STFS As New STFSPackage(File, Nothing) For Each Folder As STFS.FolderEntry In STFS.FolderDirectory Dim nodocartelle As New Node() nodocartelle.Tag = Folder nodocartelle.Name = Folder.Name nodocartelle.Text = Folder.Name Node1.Nodes.Add(nodocartelle) Next ListViewEx1.Items.Clear() MsgBox(STFS.FileDirectory.ToString) For Each Entry As STFS.FileEntry In STFS.FileDirectory Dim salvataggio As New ListViewItem() salvataggio.Tag = Entry.GetPath salvataggio.Name = Entry.Name salvataggio.Text = Entry.Name salvataggio.SubItems.Add(Entry.Size.ToString) ListViewEx1.Items.Add(salvataggio) Next
well when you create the instance of the folder just read the entries inside it and append that node while doing it....... or create a click event so when the user clicks on the node you can at that time pass the entries to the listview
c0ma's reading all entries would work (linear folder traversal), although, you could also look into using recursion depending on the folder structure depth (more nested folders = more chance of a stack overflow), but it could be a useful implementation of recursion.