Until some time back I was using Smart Defrag to defragment my hard drive. It is a nice program but the problem I faced was it won't start on its own even I selected AutoDefrag. Probably because my CPU usage is always high owing to all the programs I keep running. The Windows Defragmentor is good and works well in Windows 7 unlike as in XP where it cause system to hang. Normally I would run CCleaner to remove junk off the hard disk before using any defragmentor so that clutter stays away while HDD is optimized for free space. But then, invoking both programs manually is something I would always forget.
One option was to add them to task scheduler with a little time gap so that Ccleaner runs first and then, Defragmentor runs. But I could not find out a method to auto tune cleanup junk files in Ccleaner (is it possible to pass any parameters to it?). Same problem with defragmentor, I could not skip analyzing part to directly get the defrag working. And it seems we have to configure it first as to what all drives to defrag.
I found a better way (at least in my opinion, it is good). I created a batch file that does:
1. Cleans up all temp files from C drive
2. Removes all log files from C drive
3. Runs Defrag on C drive - first consolidates the free space and then defrags and then again consolidates free space.
A little more work is required with this file to:
1. find out folders containing data from browsers: cookies, form data, login data etc so that they can be deleted automatically
2. find out useless files and folders created by Office 2010 applications so that they too can be removed automatically
3. Make a list of other folders and file types that need not be present on my computer and include them in the delete list.
As of now, it removes .temp; .tmp; and .log files before proceeding to defrag (command line command - advantage is that it offers some additional command over the defrag process when compared to its GUI counterpart). Here is a snap how my batch file looks like:
So, it starts on its own, cleans, defrags and does a quick check on system files before exiting on its own.
As far as I know, blindly removing all tmp/temp files should not affect the OS in any negative way. Since I am not much into reading log files, no harm in eliminating them as well? I will sit one day and figure out the other folders etc (though the /s switch with DEL should delete tmp files all over the C drive) that need to be cleaned on a timely basis. Now this batch file is added to Task Schedule and runs once a week w/o I having to initiate each action one by one.
Your comments? I can share the file but am not sure if it is totally safe method.
Will upload it somewhere once am convinced and add the other points I mentioned above. Meanwhile, if you can give any advice on improving it, please do.