I am coding to watch a XYZ folder on the timer tick interval 30,000. If the XYZ folder have the filecount+1 then I want to copy a new file to process.
I can code the rest but stuck at:
Error 1 'filesindir' is not declared. It may be inaccessible due to its protection level.".
I want to initialize the Filesindir and filesinfo only once. Not on every Tick but have to move/copy new file every time.
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim processedfiles = My.Computer.FileSystem.GetFiles(destfolderpath, "*.ps")
If processedfiles.Count = (pfiles + 1) Then
If flag = False Then
Dim foldertosearch As New IO.DirectoryInfo(folderpath)
Dim filesindir As IO.FileInfo() = foldertosearch.GetFiles("*.txt")
Dim filesinfo As IO.FileInfo
End If
For Each filesinfo In filesindir
Next
End If
pfiles = processedfiles.Count
End Sub