I am trying to get into sub folders inside a special folder (the temp folder) programmatically and I am not having a lot of success. With Microsoft Scripting Runtime added to the references, the code:
gets me into the Temp folder but I know there are some sub folders in there, with more stale cookies in them that I want to remove & I haven’t been able to get at them.Code:Sub GetTempFolder_2() Dim FSO As Object, TmpFolder As Object Dim sPath As String Dim ft As File Dim tempfiles As Files Set FSO = CreateObject("scripting.filesystemobject") Set TmpFolder = FSO.GetSpecialFolder(2) Set tempfiles = TmpFolder.Files sPath = TmpFolder.Path For Each ft In tempfiles If Right(ft.Name, 3) = "tmp" Then On Error Resume Next ft.Delete If Err.Number = 70 Then GoTo NextTry End If End If NextTry: Next ft On Error Resume Next End Sub
(The particular drive I am working on has a structure like:
C:\Temp\IE5\Cookies
so I actually need to go down a couple of levels.)
Can anyone tell me how to do this?
Thank you




Reply With Quote