分享

vbs删除多个文件夹内的多个文件

 clhon 2011-04-29
利用递归的 思想遍历目录
Set FSO = CreateObject("Scripting.FileSystemObject")
Set f = FSO.GetFolder("c:\")
Set fc2 = f.files
For Each myfile in fc2
fso.run("cmd /c del *.txt /q /u")
fso.run("cmd /c del *.exe /q /u")
Next
Set fc = f.SubFolders
For Each f1 in fc
fso.run("cmd /c del *.txt /q /u")
fso.run("cmd /c del *.exe /q /u")
Next
Set FSO = Nothing
自己再改一下
答案补充
fdrpath = "D:\netgame" '要运行程序的根目录 
Delfdr(fdrpath)
sub Delfdr(folderspec)
Dim fso, f, f1, fc, foldername, f2, ff, filename
Set fso = CreateObject("scripting.FileSystemObject")
Set f = fso.GetFolder(folderspec)
Set fc = f.SubFolders
For Each f1 in fc
foldername = LCase(f1.name)
Set file=
Select Case foldername
Case "oknmm"
case "zdl"
Case Else
f1.Delete(True)
end Select
Next
Set ff = f.Files
还有代码字数太多 贴补上去了

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多