Click to See Complete Forum and Search --> : Temporary Internet Files


Limor Janah
August 28th, 2001, 03:22 AM
Hi

i am trying to delete all the files in the folder
"Temporary Internet Files" by code

i tryed to use 'dir$' and 'kill' functions but it is not working

i am trying to access the explorer and activate the button 'Delete Files..'


any idea ???

limor

DSJ
August 28th, 2001, 03:49 PM
Add a reference to Windows Scripting Runtime DLL (c:\windows\system\scrrun.dll) and try this behind a button:


private Sub Command1_Click()
Dim fs as FileSystemObject
Dim fld as Folder
Dim f as File

set fs = new FileSystemObject
set fld = fs.GetFolder("C:\Windows\Temporary Internet Files")
If fld.Files.Count > 0 then
for Each f In fld.Files
If f.Attributes <> (ReadOnly Or System Or Directory) then
f.Delete false
End If
next
End If

set f = nothing
set fld = nothing
set fs = nothing

End Sub