Automating and housekeeping my computer…

   Just still on a good vibe here from getting all my important information off the desktop and onto the server where backing it up is no longer something either I, or my desktop, have to worry about.  Now I thought I’d share how I automated some of the housekeeping that happens on my computer on a daily basis.
   Some background first.
   My wife and I listen to podcasts quite a bit.  Her on her walk to work, and myself, when I’m out driving around alone (I have a stereo that can play mp3’s on SD cards, I don’t wear headphones while driving, that would be weird.
   I also have an adorable son, and while we take loads of photos of him for ourselves, friends and family also love to take their own pictures and send them to me, which I like to add to our personal collection for backup and Picasa.
   Finally, I find myself often downloading programmes or files, using them, deleting them, then realizing I want to try them again after reading more, so I like to file them properly and keep them around.
   I tried Lifehacker’s Belvedere programme, but it wasn’t able to perform multiple functions on the same file, and I also have a personal bias against installing anything that requires, well, installing!
   By first downloading the Microsoft forfiles.exe (available here) to my C:WINDOWS directory, and working some huge command line voodoo, I was able to achieve all my ambitions directly from the command line.
   First I created the following batch file :

rem Copy podcasts to the podcasts directory.

copy /y “\NASVolume_1My Documents*.mp3” “\NASVolume_1My DocumentsMy MiscellaneousMy Podcasts”

rem Move podcasts to the wife as well.

move /y “\NASVolume_1My Documents*.mp3” “\NASVolume_1My DocumentsMy MiscellaneousWife’s Podcasts”

rem Move pictures to My Pictures directory.

move /y “\NASVolume_1My Documents*.jpg” “\NASVolume_1My DocumentsMy Pictures”
move /y “\NASVolume_1My Documents*.gif” “\NASVolume_1My DocumentsMy Pictures”
move /y “\NASVolume_1My Documents*.bmp” “\NASVolume_1My DocumentsMy Pictures”
move /y “\NASVolume_1My Documents*.pdf” “\NASVolume_1My DocumentsMy Pictures”

rem Move everything else to My Flotsam directory and delete stuff older than a month.

move /y “\NASVolume_1My Documents*.*” “\NASVolume_1My DocumentsMy MiscellaneousMy Flotsam”
PushD “\NASVolume_1My DocumentsMy MiscellaneousMy Flotsam” &&(“forfiles.exe” /s /m *.* /d -31 /c “cmd /c del @file”) & PopD

rem Run CCleaner.

“\NASVolume_1My DocumentsMy MiscellaneousMy EssentialsCCleanerCCleaner.exe” /AUTO

rem Standby Computer.

rundll32 powrprof.dll,SetSuspendState 

  You can sorta see how it all works.  I download EVERYTHING to the root “My Documents” folder (which has such a long UNC because it’s actually been moved off the desktop and onto the NAS), and from there, either specifically define where I want it to go, or just sit back and let my computer do the common ones for me.
   MP3’s get copied and them moved to both of our directories, because we have such similar tastes in what we want to listen to.  Pictures (and .PDF’s) get copied to the My Pictures folder where I can organize them further before letting Picasa work its magic.  Everything else goes to the “My Flotsam” subdirectory, where it can sit for a month before being automatically deleted thanks to the forfiles executable which really should be included with every flavour of Windows!
   Now, all you need to do is head to Start > All Programs > Accessories > System Tools > Scheduled Tasks and create a new task that points to your batch file.  I have decided to let my computer go to standby, as it only takes four seconds to come back, and hopefully saves a bit of hydro and money…  So I have the task scheduled to run whenever the computer has been idle for ten minutes.  The final line of the batch file is the command prompt method for putting your computer into standby (or do they call it sleep nowadays?)
   Anyway, it took me a bunch of ciphering and pilfering from other websites to get this all together and working for me, and I thought others might appreciate it…  Let me know!

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.