Category Archives: Application

Using BBEdit’s shell worksheet to rename files

BBedit’s shell worksheet can be a really handy tool for batch renaming files. I was inspired to give it a shot after seeing a script that handed off a directory listing for editing. Here’s a really trivial example. Let’s say I have a directory containing the following files (and I’ve cd‘d to it in the worksheet):

foo1.txt
foo2.txt
foo3.txt

And let’s say those files are actually Markdown, so I want to change the extension to .md.

First, type ls and execute it with Control-Return to get the listing of those files in your worksheet window. The result looks like the example above.

Next, highlight the listing, and bring up the “Find” dialogue. Make sure that “Grep” and “Selected text only” are selected.

Enter the pattern (.*?)(\.txt), meaning a lazy search of any characters up to a literal .txt, broken into two tokens. The first token is the file name, the second token is the extension. You want to replace that with mv \1\2 \1.md;. The result will look like this:

mv foo1.txt foo1.md;
mv foo2.txt foo2.md;
mv foo3.txt foo3.md;

Select those lines and execute them using Control-Return. If you do another ls, you’ll see your files have been renamed.

This example is really simple, just to get you thinking about the kind of file renaming you can do. Remember that a shell worksheet in BBEdit is a regular editing window. Any snippets, scripts, or text factory you have set up are available to you.

Triage email for iPhone

With Mailbox opening up to everyone, and thus devouring the media attention for email clients, I thought this might bear mentioning. Triage is a simple email client designed to very quickly work through only the new mail in your inbox. With a flick you decide to archive or keep a message. If you keep it, it stays unread in your inbox, but you won’t see it again in Triage. You can also type out a quick reply. Works with anything that uses IMAP. I’ve sent the developers an email to see if it’s possible to have Triage delete rather than archive. If so, it’s a definite buy for me.

UPDATE: Just heard back from the developers, and the app can indeed be set to update rather than just archive.