Rewriting a one-line bash script as a 74-line Go program

I love Go, but my full-time job doesn't give me much opportunity to practice. As a member of a team of Python developers, it wouldn't do to start writing things in Go that others might have to maintain without a really good reason. I've found a couple of cases that allowed me to indulge, but for the most part it's Python for me.

The "problem"

I have a folder named temp in my home folder. It's the default location for my browser to download to. So every funny picture I right-click on and every e-mail attachment I download goes there. I have an agreement with myself to move things I actually care about to another location. Otherwise, anything in this folder gets deleted after 90 days. This is done with a simple bash script:

#!/usr/bin/env bash

find /home/shawn/temp -mtime +90 -exec rm -f {} \;

The result

Source code here.

YouTube video of the walkthrough.

Comments !

blogroll

social