# Delete cookie

**URL:** <https://www.ruby-forum.com/t/delete-cookie/139646>\
**Category:** Ruby\
**Created:** [June 5, 2008, 6:50pm UTC](https://www.ruby-forum.com/t/delete-cookie/139646 "2008-06-05T18:50:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aidy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eada6e/32.png) [@aidy](https://www.ruby-forum.com/u/aidy)\
**Post date:** [June 5, 2008, 6:50pm UTC](https://www.ruby-forum.com/t/delete-cookie/139646/1 "2008-06-05T18:50:11Z")

</div>

Hi,

Does anyone know of an effective way to delete cookies?

I have been using this:

`
 class Cookie
    def kill (dir= \
                  "C:\\Documents and Settings\\"+ENV['USERNAME']+"\
\Local Settings\\Temporary Internet Files")
    require 'fileutils'
    FileUtils.rm_rf dir
   end
 `

But doesn’t seem to always work

Aidy

---

<div class="post-metadata">

**Author:** ![aidy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eada6e/32.png) [@aidy](https://www.ruby-forum.com/u/aidy)\
**Post date:** [June 5, 2008, 7:04pm UTC](https://www.ruby-forum.com/t/delete-cookie/139646/2 "2008-06-05T19:04:52Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

aidy wrote:  
| Hi,  
|  
| Does anyone know of an effective way to delete cookies?  
|  
| I have been using this:  
|  
| `
| class Cookie
| def kill (dir= 
| “C:\Documents and Settings\”+ENV[‘USERNAME’]+"
| \Local Settings\Temporary Internet Files")
| require ‘fileutils’
| FileUtils.rm_rf dir
| end
| `  
|  
| But doesn’t seem to always work

What are the error messages you get, if any?

Remember, if a file is in use, you cannot delete it (OS level lock), and  
it may be possible that Internet Explorer is still running.

Another way to accomplish what you could be the win32ole library, to use  
IE to delete the cookies.

* * *

Phillip G.  
Twitter: [twitter.com/cynicalryan](http://twitter.com/cynicalryan)  
Blog: [http://justarubyist.blogspot.com](http://justarubyist.blogspot.com)

~ Why waste time learning, when ignorance is instantaneous?  
– Calvin  
-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.8 (MingW32)  
Comment: Using GnuPG with Mozilla - [http://enigmail.mozdev.org](http://enigmail.mozdev.org)

iEYEARECAAYFAkhIHE0ACgkQbtAgaoJTgL+I5wCfXx6ZXyAgOOJjctajfMRFqdlq  
5AkAn37TYiCEEHp4C0U2QaGhqInpxBTV  
=FnhJ  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![aidy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eada6e/32.png) [@aidy](https://www.ruby-forum.com/u/aidy)\
**Post date:** [September 8, 2009, 6:51am UTC](https://www.ruby-forum.com/t/delete-cookie/139646/3 "2009-09-08T06:51:59Z")

</div>

aidy wrote:

> Hi,
> 
> Does anyone know of an effective way to delete cookies?
> 
> I have been using this:
> 
> `
> class Cookie
> def kill (dir= \
> "C:\\Documents and Settings\\"+ENV['USERNAME']+"\
> \Local Settings\\Temporary Internet Files")
> require 'fileutils'
> FileUtils.rm_rf dir
> end
> `
> 
> But doesn’t seem to always work
> 
> Aidy

Hi,

Its very delayed reply for this thread. But i hope it will help for  
person who are still facing the same issue.  
Hi All,

URL →

> **[Ruby – Accessing CCleaner](https://raveendran.wordpress.com/2009/09/07/ruby-accessing-ccleaner/)**
>
> Steps to work with CCleaner in Windows 1. Go and read about software -\> 2. Go and download the exe from –\> 3. install CCleaner.exe 4. After installed please set path. 5. Run the exe fro…

This article will help to delete cookies,temp files in windows machine.
