GioCities

blogs by Gio

My Pal Sorter

  • Posted by GiovanH in 🔨 tech

I’ve decided to do a short write-up on a tool I just call “Sorter”. Sorter is something I built for myself to help me organize my own files, and it looks like this:

animated sort demo

It’s designed to do exactly one thing: move files into subfolders, one file at a time. You look at a file, you decide where it goes, and you move it accordingly. It’s the same behavior you can do with Explorer, but at speed.

You can download it if you want (although it might not be easy to build; check the releases for binaries) but for now I just wanted to talk through some of the features, why I built it the way I did, and the specific features I needed that I couldn’t find in other software.

I made Sorter with pure python and tkinter interface components. Do not make a GUI program with pure pythona and tkinter interface components. It, and its relevant documentation, is ancient and abandoned. From what I’ve seen the modern GUI toolkit to use for a program like this is PyQT, although I haven’t worked with it yet.

Sorter has a “current working directory” you open when you start the program. It expects all “loose” files to be loose in the root of the working directory, or in a folder titled “Unsorted”. Additionally, if there’s an “Unsorted” folder and loose files, it will offer to move them to Unsorted for you.

It creates a list of those loose files and seeks through the list one file at a time. You can filter this list by fileglob; the current default is *.png, *.jpg, *.bmp, *.jpeg, *.tif, *.jfif, *.tga, *.pdn, *.psd, *.gif, *.gifv, *.webm, *.mp4, *.mov, *.webp for images and image-like files.

The “candidate folders” the current file can be moved into are on the list on the left. In the “Move to Folder ID” box, typing a string that matches one of the candidate folders moves the file to that folder.

Crucially, this matching is done aggressively. With only a few subfolders, you usually only need to type one letter to get an unambiguous match.

Partial match demo

There are more sophisticated rules that kick in if the first few letters are frequently common. For example, “j e” matches “john ebgert” and not “john arbuckle”. You can even turn on extremely aggressive fuzzy matching that matches freely inside strings, so “u” matches even “qwertyuiop”.

The goal is to make the mechanical operation of moving the folder as fast as possible. For each file, you should be spending as close to 100% of your as possible making decisions about filing, not doing the mechanical act of filing. That’s what computers are for!

Trying to do this with explorer is miserable. The best way I found of doing it is drag-and-drop with two windows open, which means you’ll spend most of your time hunting for the folder in the list and dragging your mouse to the right place. That’s fine for general-purpose use, but it’s no good for bulk sorting.

There are plenty of blazing-fast, efficient tools for moving and manipulating files, but they’re mostly command-line utilities that can’t inspect images. Sorter makes that operation almost instant, and does the moving operation itself in the background, so you can focus on decision making, which is the one thing the computer can’t do.

There are other controls on the left, too. “Move to new folder” ignores the candidate folders and moves the file as-is to a new folder it creates. “Rename” changes the name of the file without moving it, and “Rename Prefix” adds the prefix you specify to the filename. (This is good for adding indexes or page numbers or anything you want to easily sort on!)

Sorter mainly focused around quickly inspecting images, but there are also some fallbacks for other formats, like grabbing the first frame of a video, or getting a list of a zip file’s contents, or just reading the windows metainfo of the file.

Howdy! If you found my writing worthwhile, the best thing you can do to support me is to share an article you found interesting somewhere you think people will appreciate it. Thanks as always for reading!

Comments

Loading...