我无法准确指出导致此错误的原因。我要做的就是在使用代码经过一定时间后将当天创建的文件(pdf)从一个目录复制到另一个目录。这是我的代码:
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
Dim file As String
Dim now As String = DateTime.Today.ToShortDateString
Dim dir As String = "C:\PDFs\"
Dim bupdir As String = "C:\PDFs\copied\"
Dim Files() As String = Directory.GetFiles(dir)
For Each file In Files
Dim dt As String = IO.File.GetLastWriteTime(file).ToShortDateString
If dt = now Then
IO.File.Copy(Path.Combine(dir, file), Path.Combine(bupdir, file), True)
End If
Next
End Sub