Saturday, January 22, 2011

Bash them files

I had to regularly clean up a folder of old files in one of the mounts on a Linux box. Being a Python programmer mostly doing his development in Windows, the quickest solution I could think of was writing a Python script using
shutil.rmtree
.

The pseudo-code is like this:
import os
import shutil

from datetime import datetime

# save time now
# list all folders in mount
# for each folder 4 hours older than the saved time, call shutil.rmtree

Without posting all of the code you can see that I also had to handle any exception. The whole script was about 20 lines -- which I was pretty proud of...until I discovered I can do the same thing using:

find /mnt/Archive -mindepth 1 -depth -mmin +240 -delete

:/...I should have remembered the rule I was following years ago which made me somewhat master DOS batch programming.

Use the right tool for the job...and shell commands (and shell scripts) more often than not perform a stellar job at system maintenance.

*sigh* I've been trying to put off having to learn
awk, sed, xargs, etc
which are often used in conjuction with other commands in shell scripting. It has finally caught up with me.

Wednesday, January 12, 2011

Linux Mint on a Roll

Recent check at http://distrowatch.com/ showed that Linux Mint is now the #2 most popular Linux distribution.  A little old news I know, but I just would like to congratulate the Mint team for doing such a good job.

The latest Linux Mint distribution (codename "Julia") is so beautiful I often end up just staring at my screen, in awe of the great work that was done.

I first discovered Mint a little over a year ago when after a long hiatus, I've decided to dabble on Linux again.  Linux Mint 8 "Helena" was the one available then and it was beautiful.  But it does not compare to "Julia" at all.  Linux Mint is no longer just the Linux desktop for me...it is the desktop.

I will look for ways to contribute to the project -- personal agenda is to name a release.  Version 12 has to start with a "K" -- it has to be Kara.  In honor of my all time crush, Miss Kara David.