我会将所有文件复制到另一个位置,该程序将过滤 -7 天,当它复制到另一个位置时,它会显示所有文件都复制到 .log 中。当我将所有文件复制到该位置时,我仍然难以获取日志。请看下面:
Imports System
Imports System.IO
Public Class Form1
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim DirectoryToCopy As String
Dim NewCopy As String
Dim d As Date = Date.Today
d = d.AddDays(-7)
DirectoryToCopy = "c:\test\hmm.gdb"
NewCopy = "D:\Data\hmm.gdb"
'NewCopy = "D:\Data\hmm.gdb" & d.AddDays(-7)
Dim objWriter As New System.IO.StreamWriter("D:\Data\update.log")
If System.IO.Directory.Exists(DirectoryToCopy) = True Then
My.Computer.FileSystem.CopyDirectory(DirectoryToCopy, NewCopy, True)
Directory.GetFiles(NewCopy, d)
d = Directory.GetCreationTime(NewCopy)
System.IO.File.Copy(DirectoryToCopy, NewCopy)
' System.IO.File.Copy(NewCopy, "D:\Data\update.log")
'objWriter.WriteLine("file copy")
'objWriter.Close()
'MsgBox("File Copied")
End If
End Sub
End Class