gblss Posted February 15, 2013 Share Posted February 15, 2013 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 More sharing options...
JohnOne Posted February 15, 2013 Share Posted February 15, 2013 What do you mean by "filedelete does not find the file"? Show example code, and the return value from FileDelete(). AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
gblss Posted February 15, 2013 Author Share Posted February 15, 2013 Dim $var1, $file, $line, $search, $value $var1 = FileDelete(@UserProfileDir & "\AppData\Local\Microsoft\Windows\Temporary Internet Files\000301.txt") MsgBox(0, "", $var1, "") Attachment shows location of file, Link to comment Share on other sites More sharing options...
JohnOne Posted February 15, 2013 Share Posted February 15, 2013 (edited) change MsgBox(0, "", $var1, "") to MsgBox(0, $var1, @error) what is title and test of msgbox? Edited February 15, 2013 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
JohnOne Posted February 15, 2013 Share Posted February 15, 2013 Then try with "#RequireAdmin" somewhere in your script. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
gblss Posted February 15, 2013 Author Share Posted February 15, 2013 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 More sharing options...
JohnOne Posted February 15, 2013 Share Posted February 15, 2013 first there is no attachment, and second is it too difficult to just type 1 or 0 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
gblss Posted February 15, 2013 Author Share Posted February 15, 2013 Sorry I did not hit attach this file. Link to comment Share on other sites More sharing options...
JohnOne Posted February 15, 2013 Share Posted February 15, 2013 What are the file attributes of 000301.txt? from help file "Some file attributes can make the deletion impossible." AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
gblss Posted February 15, 2013 Author Share Posted February 15, 2013 I am sure they are system or hidden files attached is what is displayed under properties. That is why I was asking if anyone had done this. That is a system folder. Link to comment Share on other sites More sharing options...
gblss Posted February 15, 2013 Author Share Posted February 15, 2013 I did not see an option for rundll32 to just delete 1 file. Link to comment Share on other sites More sharing options...
JohnOne Posted February 15, 2013 Share Posted February 15, 2013 Might be worth taking a look with FileGetAttrib() function. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
gblss Posted February 15, 2013 Author Share Posted February 15, 2013 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 More sharing options...
JohnOne Posted February 15, 2013 Share Posted February 15, 2013 If the file is not really at that location you need to find where it really is. I'm out of ideas, but this thread might help you. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 15, 2013 Moderators Share Posted February 15, 2013 JohnOne,If the file is not really at that location you need to find where it really isI would imagine that folder redirection is taking place. gblss,What OS are you running? M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
JohnOne Posted February 15, 2013 Share Posted February 15, 2013 JohnOne,I would imagine that folder redirection is taking place. Ah! WinVoodoo, I get it Cheers M32. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
gblss Posted February 15, 2013 Author Share Posted February 15, 2013 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 More sharing options...
Moderators Melba23 Posted February 15, 2013 Moderators Share Posted February 15, 2013 JohnOne,Cheers M32I always thought I went to Gatwick rather than Bristol. M23 JohnOne 1 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Trong Posted February 15, 2013 Share Posted February 15, 2013 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 More sharing options...
Trong Posted February 15, 2013 Share Posted February 15, 2013 (edited) 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: expandcollapse popupFunc _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 February 15, 2013 by Trong Regards, Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now