欢迎来到代码驿站!

VBS

当前位置:首页 > 脚本语言 > VBS

清除垃圾的VBS文件 自动查找多个盘

时间:2020-11-02 17:04:24|栏目:VBS|点击:
复制代码 代码如下:

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

上一篇:灵活实用VBS入门教程应用篇

栏    目:VBS

下一篇:VBS基础教程

本文标题:清除垃圾的VBS文件 自动查找多个盘

本文地址:http://www.codeinn.net/misctech/18249.html

推荐教程

广告投放 | 联系我们 | 版权申明

重要申明:本站所有的文章、图片、评论等,均由网友发表或上传并维护或收集自网络,属个人行为,与本站立场无关。

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:914707363 | 邮箱:codeinn#126.com(#换成@)

Copyright © 2020 代码驿站 版权所有