Dim i As Integer = 0 Dim BatchNumber As String 'Target Directory Dim directory = "\\fppdszv03\GPM-QM\PROD\Indigo5500" ' C:\Users\Shafiul Alam\Desktop\Hot Folder For i = 0 To dgv.Rows.Count - 1 BatchNumber = dgv.Rows(i).Cells(0).Value & "*.mjm" For Each filename As String In IO.Directory.GetFiles(directory, BatchNumber, IO.SearchOption.AllDirectories) dgv.Rows(i).Cells(5).Value = "Searching.." 'The next line of code gets only file extensions from searched directories and subdirectories Dim fName As String = filename 'IO.Path.GetExtension(filename) Dim FileInfo As New FileInfo(filename) dgv.Rows(i).Cells(6).Value = FileInfo.Name dgv.Rows(i).Cells(7).Value = filename dgv.Rows(i).Cells(5).Value = "File Found" 'Label6.Text = Label6.Text + 1 dgv.Rows(i).Cells(8).Value = "C:\Users\Shafiul Alam\Desktop\DFE\" & FileInfo.Name File.Copy(dgv.Rows(i).Cells(7).Value, dgv.Rows(i).Cells(8).Value) dgv.Rows(i).Cells(5).Value = "Send to DFE" 'Label7.Text = Label7.Text + 1 dgv.Rows(i).Cells(5).Style.BackColor = Color.DarkGreen Next Next
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)