
path="D:\123"首雹碧 ' 要搜索的文肆袜件夹
Set fso=CreateObject("scripting.filesystemobject")
scan path,Tpath
For Each sfolder In fso.GetFolder(path).SubFolders
scan sfolder,Tpath
Next
Sub scan(folder,Tpath)
For Each file In fso.GetFolder(folder).Files
exr=fso.GetExtensionName(file.Path)
If exr="xml" Then
If Right(file.Name,6)="aa.xml" Then
If fso.FileExists(Tpath&"\"&file.Name) Then
a=MsgBox("文件 "&file.Name&" 已存在,是否覆盖?"&vbCrLf&vbCrLf&"源:"&file.Path,vbInformation+vbOKCancel,"警告")
If a=1 Then
file.Copy Tpath&"\者举",True
End If
Else
file.Copy Tpath&"\"
End If
End If
End If
Next
End Sub
set r=createobject("scripting.filesystemobject"唯搭拿)p="c:\a.rar"'指搭目标
w="tem1.rar"'源枝纳
pth="d:\123\a34"'源文件夹
f pth
d pth
sub d(x)
on error resume next
for each i in r.getfolder(x).subfolders
f i
d i
next
end sub
sub f(n)
for each c in r.getfolder(n).files
if instr(1,c,w,1)>0 then
r.copyfile c,p
if r.fileexists(c) then
msgbox"成功",64
else
msgbox"失败",16
end if
wscript.quit
end if
next
end sub
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)