Sometimes doing tasks manually is the best way, sometimes the best idea is to write an awesome script that is future proof. But sometimes, the best way is a mix of them, something you can write and then throw away.

Here’s an example.

You have hundreds of files, they need to be moved into directories based on their filenames. Take the images below as an example. We need to sort each file into their respecitve date (17, 18, 19 and so on) and we also need to create the folders because they are non existant at the moment.


So the first step is to actually get all filenames into sublime so that we can process them.

To do this, we can use the commands ls and pbcopy. This will simply get the list of files into the clipboard. Use it like this ls | pbcopy.

After this, we can use the magic of multiple cursors in sublime.


After this, all you need to do is to copy paste this script into your terminal and run it. It will create the folders and move the files. And then you’re done.

Once you become proficient in using terminal AND the multiple cursors functionality in Sublime, this like this will come in handy all the time.

Here’s a full video of me using this technique in a real situation.