Dim folderpath,destinationfolder
rem 源文件夹
folderpath="D:\\net\\"
rem 目录文件夹
destinationfolder="D:\\net\\net\\"
Set fso=CreateObject("Scripting.filesystemobject")
Set folder=fso.GetFolder(folderpath)
rem 遍历源文件夹中的子文件夹
For Each subfolder In folder.subfolders
If subfolder.path <> "D:\net\net" then
rem 遍历子文件夹中的子文件
For Each subfile In subfolder.files
rem 判断子文件的后缀名
If fso.GetExtensionName(subfile)="csf" Or fso.GetExtensionName(subfile)="CSF" then
rem 移动符合条件的文件到指定的文件夹
subfile.Move(destinationfolder)
rem 删除包含特定文件的文件夹
subfolder.Delete(True)
Exit For
End if
next
End if
next
MsgBox "move file sucessfully!"
set fso=nothing
set folder=nothing