Hi
I'm having a problem when I list .rar-files into a ListBox. I can list .rar-files OK from subdirectories, but I need help when I want to determine if the file is actually the first part of .rar-archive. The new .rar-format packs files like:
Archive.part01.rar
Archive.part02.rar
Archive.part03.rar
...
So I have no idea when I'm listing the first part of the archive or actually listing the other parts. As you can see from my code below, I have done this but it's really primitive solution.
Also other optimization suggestions to my function are very welcomeCode:Function UpdateFiles(ByVal FolderPath As String) As Boolean 'If FolderPath is empty, return false If FolderPath = "" Then Return False End If 'Check to see if FolderPath exists If System.IO.Directory.Exists(FolderPath) = False Then 'Define ExtensionList Dim ExtentionsList() As String = {"*.rar"} 'Clear FileList FileList.Items.Clear() 'Loop through files For Each CurrentExtension As String In ExtentionsList For Each CurrentFile As String In My.Computer.FileSystem.GetFiles(FolderPath, FileIO.SearchOption.SearchAllSubDirectories, CurrentExtension) If CurrentFile.Contains(".part") Then If CurrentFile.Contains(".part01") Then 'Add file to FileList FileList.Items.Add(CurrentFile) ElseIf CurrentFile.Contains(".part001") Then 'Add file to FileList FileList.Items.Add(CurrentFile) ElseIf CurrentFile.Contains(".part0001") Then 'Add file to FileList FileList.Items.Add(CurrentFile) End If Else 'Add file to FileList FileList.Items.Add(CurrentFile) End If Next Next Else 'If FolderPath does not exist, return false Return False End If 'Return true Return True End Function![]()


LinkBack URL
About LinkBacks




Reply With Quote


Bookmarks