Reading: Felicia Day’s autobiography, You’re Never Weird on the Internet (Almost). In fact, I’m listening to it. First crack at using my library’s audio book reservation. It’s a fantastic book; very relatable and touching. A story of an interaction with a fan may have made my bus ride home uncomfortably dusty.
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
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.
Via Jason Snell, the f.lux folks have documented the process of getting f.lux onto your iPhone without jailbreaking. The process is legitimate; it uses Xcode and the new provisions in the Apple developer program. It’s a bit complicated, so you may just chose to do what I do, and wear cheap sunglasses with yellow lenses.
(For why you would care about any of this, check out Blue light has a dark side at Harvard Health.)