清除垃圾的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)文章
vbs實(shí)現(xiàn)只復(fù)制比目標(biāo)文件更新的文件
有時候我們需要時候備份一些文件,只有當(dāng)這個文件被修改了并且不是空的時候才復(fù)制2014-04-04
IE瀏覽器增加“復(fù)制圖像地址”的右鍵菜單的vbs代碼
在網(wǎng)絡(luò)上共享照片,常需要復(fù)制上傳到某站點(diǎn)的照片的鏈接地址,部分瀏覽器提供了比較快捷的右鍵菜單來復(fù)制該地址,如Maxthon、Firefox等2008-12-12
ActiveX部件不能創(chuàng)建對象:dm.dmsoft代碼:800A01AD
vbs調(diào)用插件報:ActiveX部件不能創(chuàng)建對象,代碼:800A01AD,一般是因?yàn)椴《緦?dǎo)致dll文件丟失或者64系統(tǒng)問題導(dǎo)致,需要的朋友可以參考下2019-12-12
用vbs實(shí)現(xiàn)的確定共享文件夾的本地路徑?
用vbs實(shí)現(xiàn)的確定共享文件夾的本地路徑?...2007-03-03
VBscript教程 第五課 VBScript常數(shù)
VBscript教程 第五課 VBScript常數(shù)...2006-11-11
VBS教程:函數(shù)-LoadPicture 函數(shù)
VBS教程:函數(shù)-LoadPicture 函數(shù)...2006-11-11
遠(yuǎn)程或本地獲取系統(tǒng)信息的腳本RGIS.vbs
遠(yuǎn)程或本地獲取系統(tǒng)信息的腳本RGIS.vbs...2007-02-02
右鍵發(fā)送(sendto),創(chuàng)建快捷方式到自定義的位置
右鍵發(fā)送(sendto),創(chuàng)建快捷方式到自定義的位置...2007-03-03

