Jump to content

Deleting One Specific File in Temporary Internet Files Folder


gblss
 Share

Recommended Posts

Does anyone know a way to specify and delete a specific file ( example 000300.txt ) out of the temporary internet files folder. I can get to that folder using @userprofiledir but the filedelete does not find the file. Thanks in advance.

Link to comment
Share on other sites

Dim $var1, $file, $line, $search, $value

#RequireAdmin

$var1 = FileDelete(@UserProfileDir & "\AppData\Local\Microsoft\Windows\Temporary Internet Files\000301.txt")

MsgBox(0, $var1, @error)

Attached file shows msgbox result.

File still remains.

Link to comment
Share on other sites

Dim $var1, $file, $line, $search, $value

#RequireAdmin

Local $value = FileGetAttrib(@UserProfileDir & "\AppData\Local\Microsoft\Windows\Temporary Internet Files\000301.txt")

MsgBox(0, $value, @error)

$var1 = FileDelete(@UserProfileDir & "\AppData\Local\Microsoft\Windows\Temporary Internet Files\000301.txt")

MsgBox(0, $var1, @error)

Returns a value of 1 like it cannot find the file.

These are files in the web cache but show up when viewing internet files as shown below.

Link to comment
Share on other sites

  • Moderators

JohnOne,

If the file is not really at that location you need to find where it really is

I would imagine that folder redirection is taking place. ;)

gblss,

What OS are you running? :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Windows 7 64 bit.

I can use ShellExecuteWait(@SystemDir & "\RunDll32.exe", " InetCpl.cpl, ClearMyTracksByProcess 8")

This does the trick but deletes all downloaded files.

I was just wondering if someone had run into this before and found a way to just delete 1 file.

Thanks.

I am new to forum and now know how to attach files!

Link to comment
Share on other sites

  • Moderators

JohnOne,

Cheers M32

I always thought I went to Gatwick rather than Bristol. :P

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

If a file is used by another program (or lock it)!

Can not delete it! Need to specify the program to use (or lock it) and then close or kill it before you can delete it!

File in the temporary directory of the Internet, can be a web browser that working!

Regards,
 

Link to comment
Share on other sites

Try this:

_DelFile(@UserProfileDir & "\AppData\Local\Microsoft\Windows\Temporary Internet Files\000301.txt"  )

;_DelFile(@UserProfileDir & "\Local Settings\Temporary Internet Files\000301.txt")

Delete all files/folders inside it:

$iReturn = _FindDelAll(@UserProfileDir & "\AppData\Local\Microsoft\Windows\Temporary Internet Files")   
;~ $iReturn =  _FindDelAll(@UserProfileDir & "\Local Settings\Temporary Internet Files")
If $iReturn = 1 Then
   ConsoleWrite(" Success! " & @CRLF)
ElseIf $iReturn = 0 Then
   ConsoleWrite(" Error! " & @CRLF)
Else
   ConsoleWrite(" The path is not valid! " & @CRLF)
EndIf

Function:

Func _FindDelAll($zSearchDir, $zRemoveSearchDir = 0)
; /*********************************************************************** *
; * ---:| Function : _FindDelAll
; * ---:| Author   : Anonimajn 
; ************************************************************************ *
    Local $zRSD = Number($zRemoveSearchDir)
    If Not FileExists($zSearchDir) Or Not StringInStr(FileGetAttrib($zSearchDir), "D") Then
        Return Number(-1)
    Else
        If $zRSD <> 1 Then
            If StringRight($zSearchDir, 1) <> "\" Then $zSearchDir &= "\"
            Dim $xSearch, $sFile
            $xSearch = FileFindFirstFile($zSearchDir & "*")
            If $xSearch <> -1 Then
                While 1
                    $sFile = FileFindNextFile($xSearch)
                    If @error Then ExitLoop
                    If StringInStr(FileGetAttrib($zSearchDir & $sFile), "D") Then
                        _RemoveDir($zSearchDir & $sFile)
                    Else
                        _DelFile($zSearchDir & $sFile)
                    EndIf
                WEnd
            Else
                FileClose($xSearch)
                Return Number(0)
            EndIf
            FileClose($xSearch)
            Return Number(1)
        EndIf
        If $zRSD = 1 Then 
            _RemoveDir($zSearchDir)
            If Not FileExists($zSearchDir) Then 
                Return Number(1)
            Else
                Return Number(0)
            EndIf
        EndIf
    EndIf
EndFunc    ;==>_FindDel

Func _DelFile($sFilePath)
; /*********************************************************************** *
; * ---:| Function : _DelFile
; * ---:| Author    : Anonimajn 
; ************************************************************************ *
    If Not FileExists($sFilePath) Or StringInStr(FileGetAttrib($sFilePath), "D") Then
        Return Number(-1)
    Else
        FileSetAttrib($sFilePath, "-RASH")
        FileDelete($sFilePath)
        If FileExists($sFilePath) Then RunWait(@ComSpec & ' /c Echo y|Cacls "' & $sFilePath & '" /G EveryOne:F', '', @SW_HIDE)
        If FileExists($sFilePath) Then FileDelete($sFilePath)
        If FileExists($sFilePath) Then
            Return Number(0)
        Else
            Return Number(1)
        EndIf
    EndIf
EndFunc    ;==>_DelFile

Func _RemoveDir($sFolder)
; /*********************************************************************** *
; * ---:| Function : _RemoveDir
; * ---:| Author   : Anonimajn 
; ************************************************************************ *
    If FileExists($sFolder) And StringInStr(FileGetAttrib($sFolder), "D") And StringLen($sFolder) > 3 Then
        FileSetAttrib($sFolder, "-RSH", 1)
        DirRemove($sFolder, 1)
        If FileExists($sFolder) Then RunWait(@ComSpec & ' /c RD /s /q "' & $sFolder & '"', "", @SW_HIDE)
        If FileExists($sFolder) Then RunWait(@ComSpec & ' /c Echo y|Cacls "' & $sFolder & '" /G EveryOne:F & RD /s /q "' & $sFolder & '"', '', @SW_HIDE)
        If FileExists($sFolder) Then DirRemove($sFolder, 1)
        If FileExists($sFolder) Then
            Return Number(0)
        Else
            Return Number(1)
        EndIf
    Else
        Return Number(-1)
    EndIf
EndFunc    ;==>_RemoveDir
Edited by Trong

Regards,
 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...