I needed to delete a chunk of cookies today – but I didn’t want to delete them all.
Thankfully there is a handy command that is within Windows versions after XP such as Server 2003 and Vista that will enable to clean up without too many problems.
The forfiles command will allow you to set a specific date for a file so that you don’t delete recent cookies:
<code>forfiles /S /p "C:\Users\John\cookies" /D -150 /c "cmd /c del @path"</code>
If you wanted to be super cool and delete multiple user cookie folders you could do something like this:
<code>for /D %D in (C:\Users\*) DO forfiles /S /p "%D\cookies" /D -150 /c "cmd /c del @path"</code>
This will enumerate all of the user folders in the C:\Users folder and then clean up the cookies folders inside.
If you wanted to – you can change the amount of days from 150 days to any other amount you like by changing /D -150 to any other number of days (or even use a specific date).