vb 怎样删除临时文件(IE临时文件)我的QQ 79850157   邮 [email protected] 
要有详细代码就更好
有兴趣的朋友可以加我
一起VB

解决方案 »

  1.   


    Option Explicit
    Private gstrSEP_DIR As StringSub FPDeleteTree(inPath As String)'定义临时变量
    Dim tmpPath As String, curPath As String
    Dim tmpFileName As String'保存指定路径
    curPath = inPath: AddDirSep curPath'删除所有文件,不论文件属性是否为“隐藏”,“只读”还是“系统”。
    tmpFileName = Dir(curPath, vbNormal + vbHidden + vbSystem)Do While Not tmpFileName = ""SetAttr curPath & tmpFileName, vbNormalKill curPath & tmpFileNametmpFileName = DirLoop'通过循环删除子目录及其内容
    tmpPath = Dir(curPath, vbDirectory)Do While tmpPath = "." Or tmpPath = ".."tmpPath = DirLoopDo While Not tmpPath = ""curPath = curPath & tmpPathAddDirSep curPathtmpFileName = Dir(curPath, vbNormal + vbHidden + vbSystem)Do While Not tmpFileName = ""SetAttr curPath & tmpFileName, vbNormalKill curPath & tmpFileNametmpFileName = DirLooptmpPath = Dir(curPath, vbDirectory)Do While tmpPath = "." Or tmpPath = ".."tmpPath = DirLoopIf tmpPath = "" ThenRmDir curPathcurPath = inPathAddDirSep curPathtmpPath = Dir(curPath, vbDirectory)Do While tmpPath = "." Or tmpPath = ".."tmpPath = DirLoopEnd IfLoopAddDirSep inPathRmDir inPathEnd Sub'******************************************************************************' 子程序: AddDirSep'******************************************************************************Sub AddDirSep(strPathName As String)If Right$(RTrim$(strPathName), Len(gstrSEP_DIR)) <> gstrSEP_DIR ThenstrPathName = RTrim$(strPathName) & gstrSEP_DIREnd IfEnd Sub
    Private Sub Command1_Click()
        gstrSEP_DIR = "\"
        FPDeleteTree ("d:\www")
    End Sub
      

  2.   

    用FSO对象来做简单多了哪需要这么多代码?
      

  3.   

    通过API访问IE Cachehttp://blog.csdn.net/technofantasy/archive/2002/03/29/2962.aspx
      

  4.   

    RmDir inPath 会出错为什么
    能不能写点说明代码的地方.FSO对象怎么用呀.怎么不说清点
      

  5.   

    IE的临时文件夹路径你肯定知道的,那么就可以用FSO获得该目录下全部子目录,做个循环,取每个子目录下的文件集合,再一一删除即可,不过要注意一点,有些你正在看的页面所辖文件是不能删除的,所以必须加上差错控制(on error resume next).
      

  6.   

    临时文件夹是有特殊控制的,不能像普通文件夹一样操作在FSO面前没有任何特殊性,照删不误。。
      

  7.   

    我用FSO做实验,结果把我没使用中的系统文件删光了,郁闷一天装系统。
    要慎用!!!