Friday, March 27, 2009

SafariStand downloads and the Terminal

I love SafariStand. I love SafariStand's ability to organize downloads by date. I hate trying to navigate to the current day's download directory via the terminal. I typically don't delete downloads very often so my Downloads folder tends to get cluttered with a bunch of folders titled '2009-03-11', '2009-03-15', etc.

If you're a heavy terminal user, it can be a pain to get into the current day's folder because tab-completion always stops at '2009-03-' if your folder spans just one month, '2009-' if it spans multiple months, or '200' if it spans multiple years.

I decided to rectify this situation by making an alias to the date command to generate the current date in the same format. It's pretty simple:

In your .profile or .bash_profile file in your home directory simply add the line:

alias today='date "+%Y-%m-%d"'

Then when you're in the terminal, go to your downloads folder and type

cd `today` (note the back quotes around today) (the back quote is shift-tilde)

and it will automatically generate the proper date string and take you right into your folder.

No comments: