清除垃圾的VBS文件 自动查找多个盘
来源: 阅读:1512 次 日期:2016-07-18 14:57:44
温馨提示: 小编为您整理了“清除垃圾的VBS文件 自动查找多个盘”,方便广大网友查阅!

可以删除.tmp ._mp .log .gid .chk .old file文件和 temp,recent,cookis,recycled,prefetch,and "Temporary Internet Files"文件夹。

代码如下:

rem made by correy

rem made at 2007.9.22

rem it can be delete you computer's the follow things(except cd,dvd)

rem it can be delete empty file and folder

rem it can be delete .tmp ._mp .log .gid .chk .old file

rem it can be delete temp,recent,cookis,recycled,prefetch,and "Temporary Internet Files" folder.

rem i am thinking how to delete the same size and same name's file and folder

On Error GoTo 0

Set fso = CreateObject("Scripting"&"."&"FileSystem"&"Object")

for n = 1 to 3

For Each d in fso.Drives

if d.drivetype=4 then

Exit For

else

scan(d)

end if

next

next

sub scan(folder)

on error resume next

set folder=fso.getfolder(folder)

for each file in folder.files

if file.size=0 then

file.delete(true)

end if

ext=fso.GetExtensionName(file)

ext=lcase(ext)

if ext="tmp" or ext="_mp" or ext="log" or ext="gid" or ext="chk" or ext="old" then ''30

file.delete(true)

end if

next

for each subfolder in folder.subfolders

rem instrRev() can't be used,i want to find "\".

if left(subfolder.path,4)="temp" or left(subfolder.path,8)="recycled" then

subfolder.delete(true)

elseif left(subfolder.path,6)="recent" or left(subfolder.path,7)="cookis" then

subfolder.delete(true) rem 40

elseif left(subfolder.path,24)="Temporary Internet Files" or left(subfolder.path,8)="prefetch" then

subfolder.delete(true)

end if

if subfolder.size=0 then subfolder.delete(true)

scan(subfolder)

next

end sub

更多信息请查看脚本栏目
由于各方面情况的不断调整与变化, 提供的所有考试信息和咨询回复仅供参考,敬请考生以权威部门公布的正式信息和咨询为准!

2025国考·省考课程试听报名

  • 报班类型
  • 姓名
  • 手机号
  • 验证码
关于我们 | 联系我们 | 人才招聘 | 网站声明 | 网站帮助 | 非正式的简要咨询 | 简要咨询须知 | 加入群交流 | 手机站点 | 投诉建议
工业和信息化部备案号:滇ICP备2023014141号-1 云南省教育厅备案号:云教ICP备0901021 滇公网安备53010202001879号 人力资源服务许可证:(云)人服证字(2023)第0102001523号
云南网警备案专用图标
联系电话:0871-65317125(9:00—18:00) 获取招聘考试信息及咨询关注公众号:
咨询QQ:526150442(9:00—18:00)版权所有:
云南网警报警专用图标
Baidu
map