Swiftor Posted August 23, 2011 Share Posted August 23, 2011 Hi All, I've been trying to write a small script to remove all Internet Explorer cookies, but I'm apparently having some trouble. I wasn't exactly sure which directory held all of the cookies because there are so many, but in my code below I'm positive that it's the second element in the array (at least for windows 7). I seem to be having trouble deleting the files in there though.. it just doesn't work. Here's my code thus far: #include <Array.au3> #include <File.au3> Local $aDirectories[6] $aDirectories[0] = @UserProfileDir&"\Cookies" $aDirectories[1] = @UserProfileDir&"\AppData\Local\Microsoft\Windows\Temporary Internet Files" $aDirectories[2] = @UserProfileDir&"\Local Settings\Temporary Internet Files" $aDirectories[3] = @AppDataDir&"\Local\Microsoft\Windows\Temporary Internet Files" $aDirectories[4] = @AppDataDir&"\Roaming\Microsoft\Windows\Cookies\Low" $aDirectories[5] = @AppDataDir&"\Roaming\Microsoft\Windows\Cookies\Low\Temporary Internet Files" For $Directory in $aDirectories If FileExists($Directory) Then $FileList=_FileListToArray($Directory, "*") For $i = 0 To UBound($FileList) - 1 $File = $Directory & "\" & $FileList[$i] If FileExists($File) Then FileDelete($File) EndIf Next EndIf Next Help? Link to comment Share on other sites More sharing options...
JohnOne Posted August 23, 2011 Share Posted August 23, 2011 "it just doesn't work" is not offering much helpful info is it. How about what about it dosent work, what error you receive etc... 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...
Swiftor Posted August 23, 2011 Author Share Posted August 23, 2011 "it just doesn't work" is not offering much helpful info is it.How about what about it dosent work, what error you receive etc...It's not deleting the files in the directories. I'm not getting any error message.. just the files aren't getting deleted. Link to comment Share on other sites More sharing options...
guinness Posted August 23, 2011 Share Posted August 23, 2011 What about this >> #include <Array.au3> #include <File.au3> Global $aDirectories[6], $aFileList $aDirectories[0] = @UserProfileDir & "\Cookies" $aDirectories[1] = @UserProfileDir & "\AppData\Local\Microsoft\Windows\Temporary Internet Files" $aDirectories[2] = @UserProfileDir & "\Local Settings\Temporary Internet Files" $aDirectories[3] = @AppDataDir & "\Local\Microsoft\Windows\Temporary Internet Files" $aDirectories[4] = @AppDataDir & "\Roaming\Microsoft\Windows\Cookies\Low" $aDirectories[5] = @AppDataDir & "\Roaming\Microsoft\Windows\Cookies\Low\Temporary Internet Files" For $A = 0 To 5 If FileExists($aDirectories[$A]) Then $aFileList = _FileListToArray($aDirectories[$A]) If @error Then ContinueLoop EndIf For $B = 1 To $aFileList[0] ConsoleWrite("FileDelete(" & $aDirectories[$A] & "\" & $aFileList[$B] & ")" & @LF) Next EndIf Next UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Swiftor Posted August 23, 2011 Author Share Posted August 23, 2011 What about this >> #include <Array.au3> #include <File.au3> Global $aDirectories[6], $aFileList $aDirectories[0] = @UserProfileDir & "\Cookies" $aDirectories[1] = @UserProfileDir & "\AppData\Local\Microsoft\Windows\Temporary Internet Files" $aDirectories[2] = @UserProfileDir & "\Local Settings\Temporary Internet Files" $aDirectories[3] = @AppDataDir & "\Local\Microsoft\Windows\Temporary Internet Files" $aDirectories[4] = @AppDataDir & "\Roaming\Microsoft\Windows\Cookies\Low" $aDirectories[5] = @AppDataDir & "\Roaming\Microsoft\Windows\Cookies\Low\Temporary Internet Files" For $A = 0 To 5 If FileExists($aDirectories[$A]) Then $aFileList = _FileListToArray($aDirectories[$A]) If @error Then ContinueLoop EndIf For $B = 1 To $aFileList[0] ConsoleWrite("FileDelete(" & $aDirectories[$A] & "\" & $aFileList[$B] & ")" & @LF) Next EndIf Next I'm still having the same problem as I was before.. it is only listing the directories inside of those folders and it's not actually deleting any content inside of them. Link to comment Share on other sites More sharing options...
guinness Posted August 23, 2011 Share Posted August 23, 2011 Whoops! Use this to return files only and look at Melba23's signature for RecFileListToArray (this can search in subfolders too) it might also be a problem with access rights as well. _FileListToArray($aDirectories[$A], "*", 1) UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Swiftor Posted August 23, 2011 Author Share Posted August 23, 2011 Whoops! Use this to return files only and look at Melba23's signature for RecFileListToArray (this can search in subfolders too) it might also be a problem with access rights as well. _FileListToArray($aDirectories[$A], "*", 1) Using that the only output I get is: FileDelete(C:\Users\Chris\AppData\Local\Microsoft\Windows\Temporary Internet Files\desktop.ini) When I copy and paste that directly into my explorer (removing the desktop.ini) I'm presented with a lot more content in that directory than just the desktop.ini. Link to comment Share on other sites More sharing options...
Swiftor Posted August 24, 2011 Author Share Posted August 24, 2011 Ideas? Link to comment Share on other sites More sharing options...
Swiftor Posted August 24, 2011 Author Share Posted August 24, 2011 Is it because of lack of permissions or something, because I'm having trouble deleting anything out of the directories. Link to comment Share on other sites More sharing options...
rcmaehl Posted August 24, 2011 Share Posted August 24, 2011 (edited) You haven't -RASHOT'd the files. See FileSetAttrib in the Man pages. I had this problem too but I fixed it in my script (linky). Edited August 24, 2011 by rcmaehl My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.My Projects WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF Link to comment Share on other sites More sharing options...
Swiftor Posted August 24, 2011 Author Share Posted August 24, 2011 You haven't -RASHOT'd the files. See FileSetAttrib in the Man pages. I had this problem too but I fixed it in my script (linky).I'm getting 500 errors when trying to go there Link to comment Share on other sites More sharing options...
rcmaehl Posted August 25, 2011 Share Posted August 25, 2011 I'm getting 500 errors when trying to go thereO_o You sure. Can you post the script here and let me try it? My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.My Projects WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted August 25, 2011 Share Posted August 25, 2011 @SwiftorWhat about ClearMyTracksByProcess? That would be simpler to use if it deletes the files you're concerned with. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface 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