visualBEER310
Member
- Joined
- Aug 31, 2014
- Messages
- 6
- Programming Experience
- 1-3
Hi.
I have some code which recursively searches for files on a folder. The problem is I want it to change a boolean value once it has completed. I don't mean once it gets to the end of the sub, I mean once it's literally finished. I had to code it the way it is otherwise I would have gotten Exception errors and I need it to scan all the files it does (recycling bin etc) because it needs to do behaviour analysis which I have already done. (it already scans, just need that value thing).
The code I have is:
It's initialized like: RecursiveSearch("C:\Users\profilename\Desktop\somefolder\", "*.*", ListBox1)
When all the files are added I need it to change a boolean value. You can't use things to count files as at some points I do it for the whole drive and you'd get a error.
I have some code which recursively searches for files on a folder. The problem is I want it to change a boolean value once it has completed. I don't mean once it gets to the end of the sub, I mean once it's literally finished. I had to code it the way it is otherwise I would have gotten Exception errors and I need it to scan all the files it does (recycling bin etc) because it needs to do behaviour analysis which I have already done. (it already scans, just need that value thing).
The code I have is:
VB.NET:
Dim strFolders() As String = System.IO.Directory.GetDirectories(strPath)
Dim strFiles() As String = System.IO.Directory.GetFiles(strPath, strPattern)
'Add the files
For Each strFile As String In strFiles
Try
ListBox1.Items.Add(strFile.ToString())
' total = ListBox1.Items.Count
' ListBox1.Refresh()
Catch ex As Exception
End Try
Next
'Look through the other folders
For Each strFolder As String In strFolders
Try
'Call the procedure again to perform the same operation
RecursiveSearch(strFolder, strPattern, lstTarget)
' ListBox1.Refresh()
Catch ex As Exception
End Try
Next
It's initialized like: RecursiveSearch("C:\Users\profilename\Desktop\somefolder\", "*.*", ListBox1)
When all the files are added I need it to change a boolean value. You can't use things to count files as at some points I do it for the whole drive and you'd get a error.