Thursday 3 June 2010

Running Series: Little Tweaks, Tips and Apps (Part 2)



Automated System Cleaning
So I do a lot of ASP.NET development on my personal system. I have bursts of going through online videos. This results in a lot of garbage showing up on my system, both in the system's Temp folder as well as the Temporary Internet folder (my primary/only browser is IE). There are guides out there to show you how to Clear IE's cache and even to clear the cache for a specific domain (i.e., site) but there are a bunch of drawbacks and concerns:
  • It takes damn near forever (depending on how much junk you have accumulated)
  • Does it really clear your temporary browsing cache? (after all, your browser is still open and as a general principle, you cant delete files while applications using them are open...)
  • What if you use multiple browsers?
  • There's no easy convenient way to empty you system's temporary folders
This is where a neat little free application call CCleaner ('C' for 'crap) comes in. It's handles the deletion of temporary files, browsing cache (of multiple browsers) and general removal of "crap". It has a built in whitelist system to let you mark certain cookies you want to keep (say, your Facebook login cookie). It's pretty straightforward to run too - you just click 'analyze' then 'clean' and wait (depending on how much crap you've accumulated) and poof it's done!

It's pretty easy: double-click (to launch), click (analyze) and click (clean) and click (to close) and you're done! Normally this is something I run every so often manually (i.e., during development, when I really want to wipe cookies etc or after a particularly long session of Youtubing, or 'just because'). Being the lazy old fart I am, I figured there's got to be a better way to do things with less work. Turns out there is.

A quick little investigation yielded command line parameters for CCleaner. Turns out '/AUTO' (without the quotes) runs CCleaner in the tray with the current settings and exits when finished. Brilliant! Now just make a shortcut with the auto parameter and double-click and you're done!

There are two issues still outstanding:
  1. It still takes damn near forever (depending on the amount of crap accumulated) and
  2. What about all the cookies I do want to save? (i.e., login cookies and such)
Well there's not a whole lot you can do about the latter (you have to manually fire up CCleaner and whitelist the cookies yourself... so you'll still have to do work every so often). As for the former, common sense suggests that if you run CCleaner more often, the individual cleanings should be a relative breeze. So I thought: why not have the automated cleaning happen on a regular basis .. sure it would 'accidentally' wipe out cookies every so often, but in time, my cookie whitelist would get longer and longer and it would be less of a hassle. Worth a shot!

Here's how to make your life simpler and cleaner:
  1. Fire up Task Scheduler (taskschd.msc) .. you can find it under Administrative Tools
  2. On the right hand side, click 'Create Task'. A window pops up [sample]
  3. Setup your trigger to determine how often you want to clean your system [sample]. When you're done, it will list all your triggers [sample]
  4. Now setup what your want this automated event to actually do [sample]. When you're done it will list all the actions [sample]. For my system, I have the cleaning done every two hours.
  5. Determine the scenarios you want the cleaning to run [sample]. This will realistically only affect notebook users and those who put their system to sleep often.
  6. Set the various misc settings for the automated task [sample]. For my case, I have the system force-close if there is a crash/lock.
And that's it!

You can test the task simply by right clicking on the task in the task scheduler and selecting 'Run'. You'll see a little CCleaner icon in your system tray as it runs and it'll automagically go away when it's done it's thing. I would suggest, while you're in the Task Scheduler window, to export the task so that you dont have to do all this if you decide to format the system!

No comments:

Post a Comment