I Used this code to split a directory in size and only add the folders and files split into a treeview for each cycle.
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click Me.TreeView1.Nodes.Clear() Dim Source As String = "C:\TEST" Dim Source_Dir As New DirectoryInfo(Source) Dim Split_Size As Long = 0 For Each Files As FileInfo In Source_Dir.EnumerateFiles("*", SearchOption.AllDirectories) If (Split_Size.ToString / 1048576) >= 20 Then ' MBytes Split_Size = 0 ' Reset MsgBox("New Split Data : " & Split_Data.Text) TreeView1.Nodes.Clear() ElseIf (Split_Size.ToString / 1048576) < 20 Then TreeView1.BeginUpdate() TreeView1.Nodes.Add(Files.FullName) TreeView1.EndUpdate() TreeView1.Refresh() End If Split_Size += New FileInfo(Files.FullName).Length Split_Data.Text = (Split_Size \ 1048576).ToString("N0") & " °MB" Next MsgBox("Last Split Data : " & Split_Data.Text) End Sub
In the example I have a folder of 80mb I split the folder in 20mb in each cycle I add the parent node and related child nodes in treeview with the files, but I find myself in such a situation.
I would like a situation like this, like the classic method to add in a treeview the structure of an entire folder.. In order to read and open the files or folders split, directly from treeview... />
I tried in every way but I can not figure out how to create the structure of the treeview with inside the parent folder, including subfolders and files for each cycle of splitted folder.
I'm hoping for some help.. />