我使用以下脚本将所有特定文件移动到目标文件夹。我想将文件复制到目标文件夹而不复制。
因为我计划每 10 分钟运行一次 VBS,所以它不应该再次复制文件夹中已经存在的相同文件。
Set fso = CreateObject("Scripting.FileSystemObject")
testfolder = "D:\env"
'fso.CreateFolder(testfolder)
MoveFiles fso.GetFolder("D:\Movie Keys\License\2013_Apr_19")
Sub MoveFiles(fldr)
For Each f In fldr.Files
basename = fso.GetBaseName(f)
extension = fso.GetExtensionName(f)
If LCase(extension) = "env" Then
dest = fso.BuildPath(testfolder, f.Name)
count = 0
Do While fso.FileExists(dest)
count = count + 1
dest = fso.BuildPath(testfolder, basename & "_" & count & "." _
& extension)
Loop
f.Move dest
End If
Next
For Each sf In fldr.SubFolders
MoveFiles sf
Next
End Sub