Public Sub starting_scan() stop_Scan = False If Directory.Exists(myscanpath.Text) = True Then Scanning = True ScanScanner(txtScanningNow.Text) Else Timer1.Stop() MsgBox("The Selected Drive Or Device Is Not Ready Or Has No Scannable Content", MsgBoxStyle.Critical) SwitchButton4.Value = False Exit Sub End If Dim drives As String() = Directory.GetLogicalDrives() Dim aDrive As String For Each aDrive In drives myscanpath.Text = aDrive ScanScanner(txtScanningNow.Text) Next stop_Scan = True Timer1.Stop() Scanning = False txtScanningNow.Text = comboBox1.SelectedItem SwitchButton4.Value = False If lblvirus.Text = 0 Then DelVirusInfection.Enabled = False Else DelVirusInfection.Enabled = True End If End Sub Sub ScanScanner(ByVal dir As String) MD5Text.Text = MD5Reader.ReadToEnd Try With My.Computer.FileSystem If stop_Scan = True Then Exit Sub End If For Each file1 In Directory.EnumerateFiles(dir) Dim fs As New FileInfo(file1) ComputerFileHash.Text = getMd5Hash(fs.FullName) labelX13.Text = getSHA1Hash(fs.FullName) If MD5Text.Text.Contains(ComputerFileHash.Text) Then CheckedListBoxControl1.Items.Add(fs.FullName) lblvirus.Text = CheckedListBoxControl1.Items.Count End If getmyfileatr(file1) Dim fileDetail As IO.FileInfo fileDetail = My.Computer.FileSystem.GetFileInfo(file1) lblSizef.Text = fileDetail.Length txtScanningNow.Text = file1 Next file1 ' Search child directories. For Each folder As Object In .GetDirectories(dir) txtScanningNow.Text = folder ScanScanner(folder) Next folder End With Catch ex As UnauthorizedAccessException Return End Try End Sub
dim filePaths() as string = System.IO.Directory.GetFiles(@"c:\MyDir\", "*.bmp",SearchOption.AllDirectories)
Dale Seeley wrote:As I understand the GetFiles method only returns one file extension. I am asking how to search for multiple file extensions by altering the code i have so far.
GetFiles
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)