清除垃圾的VBS文件 自動查找多個盤
更新時間:2009年09月05日 17:20:22 作者:
可以刪除.tmp ._mp .log .gid .chk .old file文件和
temp,recent,cookis,recycled,prefetch,and "Temporary Internet Files"文件夾。
復(fù)制代碼 代碼如下:
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
相關(guān)文章
VBScript 算一算你從出生到現(xiàn)在共計多少天
VBScript 算一算你從出生到現(xiàn)在共計多少天,呵呵,努力奮斗吧2009-11-11利用VBS腳本修改聯(lián)想筆記本BIOS密碼的代碼分享
這篇文章主要介紹了利用VBS腳本修改聯(lián)想筆記本BIOS密碼的實現(xiàn)代碼,感覺這不科學(xué)!無意中找到的一些資料,喜歡的朋友可以試試2013-07-07VBScript教程 第二課在HTML頁面中添加VBscript代碼
VBScript教程 第二課在HTML頁面中添加VBscript代碼...2006-11-11VBS教程:VBscript語句-If...Then...Else 語句
If...Then...Else 語句用于計算條件是否為 True 或 False,并且根據(jù)計算結(jié)果指定要運(yùn)行的語句。通常,條件是使用比較運(yùn)算符對值或變量進(jìn)行比較的表達(dá)式。If...Then...Else 語句可以按照需要進(jìn)行嵌套2006-11-11Windows Script Host之用vbs實現(xiàn)[瀏覽文件夾]功能
Windows Script Host之用vbs實現(xiàn)[瀏覽文件夾]功能...2007-07-07