QA Graphic

Create Folder on the Desktop

Every Wednesday, I'll highlight one of my personal TextExpander shortcuts. I use TextExpander a lot to be more productive at work.

If you never heard of TextExpander, here's a brief blurb about TextExpander from Smile on my Mac: Save time and effort with TextExpander! Whether it's a simple email signature or several paragraphs of a standard response, you'll love how easy it is to use TextExpander to avoid typing the same thing over and over.

In my option, spending $44 on TextExpander is easily worth the money in long term productivity savings. This is my numbers so far:

Statistics

Situation

I like a clean desktop and so every day I create a new folder with todays date as a filename where I can store all files that I work on that day. I do this so when I am looking for something, I can open that date folder. I find it better than having an out of control Document folder.

Problem

There must be a way for me to quickly create a folder on the desktop with today's date.

Solution

To simply my daily task, I created a TextExpander Shell Script shortcut called 'xdate' that will run this simple Bash script:

#! /bin/bash
mkdir -p /Users/cryan/Desktop/$(date '+%m.%d.%Y')

I could have easily written it in AppleScript:

tell application "Finder"
do shell script "mkdir -p /Users/cryan/Desktop/$(date '+%m.%d.%Y')"
end tell

By adding the '-p' flag to the mkdir command, no error will be reported if a directory given as an operand already exists. I wanted the option to make sure that if I accidentally type the shortcut I don't see a 'Duplicate Folder' error message.

I am sure there's some practical way to do this by using Apple's launchd manager. Ideally it would be great to have this automatically done every time I login to my computer in the morning. I know that Apple's launchd manager has the ability to do that, and some time when I have a few minutes I'll learn how to set that up.

Hope this helps you write some awesome TextExpander code.

 

About

I find TextExpander, by Smile on My Mac, to be an awesome productivity tool. This past winter, I posted some cool snippets that demonstrate the power of the application. Occasionally, I will post some new snippets that I think will be useful in anyone's TextExpander library.

Schedule

WednesdayAffinity
ThursdayBBEdit
FridayMacintosh
SaturdayInternet Tools
SundayOpen Topic
MondayMedia Monday
TuesdayQA