By josh / May 14, 2014

How to bulk rename files without losing your sanity

Have you ever found yourself needing to rename a bunch of files?

Like maybe you have a folder full of photos, and you’d like to rename them to something more descriptive than DSC_2635.jpg, DSC_2636.jpg, and so on.

Or maybe you have a list of folders that were sequentially numbered … until you deleted one and added a couple more in the middle (with a b suffix to avoid naming collisions).

I had this exact problem when I was getting ready to launch Writing Sublime Plugins–http://writingsublimeplugins.com. I had created almost 30 folders with snapshots of the example plugin, but there were a few gaps and overlaps in the sequence.

Usually in these situations there aren’t quite enough files to make it worth writing a shell script to do the work, but good grief, renaming them by hand is tedious … Right click. Select. Delete. Type type type. Enter. Right click …

In my (highly limited) experience with emacs, one of the features I really liked was the dired mode.

This mode allows you to open any folder on your machine as a text buffer in emacs, then interact with the list of files as if they were just lines of text. Want to rename several files? Just edit that line. Your changes aren’t saved until you commit them, so you can rename multiple files or folders at once.

Like everything in emacs, I found this extremely powerful … but difficult to work with.

Now there’s a new Sublime Text 3 plugin that emulates dired–and it’s easier to use.

This plugin, named simply dired, allows you to open a folder as a tab in Sublime, then manipulate its contents with keyboard shortcuts.

Since the dired tab is just a regular editing pane, you can use most of your favorite shortcuts and editing tricks. (Hint: Multi-select rocks when you want to bulk rename files…)

One really nice touch: The available keyboard shortcuts are always displayed on screen, so it’s easy to see how to do a particular task.

The dired plugin is available in Package Control. Check it out today.

Want more tips like this? There’s a whole lot more here:

http://sublimetexttips.com/newsletter

About the author

josh

5comments
Nico - September 4, 2015

Really cool! Thanks for sharing this tip

Reply
Awal - October 5, 2015

Looks like the package is now broken since the Github source is no longer available.

I found a similarish repository at https://github.com/ToFu1310/dired, I guess the people responsible for maintaining Package Control need to be pinged on this so they can fix the source.

Reply
Wilo - October 8, 2015

Hey, does anyone know what’s happened to this plugin? It seems to have disappeared along with, rather creepily, the github page, and all references to it in the sublime forum.

Reply
Sebastian - November 9, 2015

Yes, this sounds great – where has it gone???

Reply
Michael - November 12, 2015

I use this plugin like crazy – my life depends on it. Please – dear developers put it back up – I will pay for it. It’s not cool to provide an awesome tool and then just pull it out from under those that depend on it. Not cool at all.

Reply
Click here to add a comment

Leave a comment: