how can i merge this two for looping in one or how can i improve this code to seek file and folders
and thank you
Code:
Try
Dim folders() As String = IO.Directory.GetDirectories(path)
Dim files() As String = IO.Directory.GetFiles(path)
For i As Integer = 0 To folders.Length - 1
datax.Rows.Add()
datax.Rows(i).Cells("time").Value = Format(Now, "HH:mm:ss")
datax.Rows(i).Cells("file").Value = folders(i)
Try
My.Computer.FileSystem.GetDirectoryInfo(folders(i)).Attributes = IO.FileAttributes.Normal
ShowAll(folders(i))
Catch ex As Exception
datax.Rows(i).Cells("result").Value = "Failed"
End Try
Next
For i As Integer = 0 To files.Length - 1
datax.Rows.Add()
datax.Rows(i).Cells("time").Value = Format(Now, "HH:mm:ss")
datax.Rows(i).Cells("file").Value = files(i)
runsome.ReportProgress(i * 10)
Try
My.Computer.FileSystem.GetFileInfo(files(i)).Attributes = IO.FileAttributes.Normal
ShowAll(files(i))
Catch ex As Exception
datax.Rows(i).Cells("result").Value = "Failed"
End Try
Next
Catch ex As Exception
MsgBox(ex, MsgBoxStyle.Information, "ToudraShow")
End Try