A tiny Go CLI for tidying screenshots
My desktop is where screenshots go to die. By the end of a week there are forty files named some variation of Screenshot 2026-01-17 at 14.22.08.png, and I can never find the one I'm looking for. Rather than keep dragging them into folders by hand, I spent an evening writing a small tool to do it.
The whole thing is about sixty lines. It walks a directory, finds files matching the screenshot naming pattern, reads the date out of the filename, and moves each one into a folder for that month. The interesting part is just the sorting:
func destDir(name string) (string, bool) {
m := pattern.FindStringSubmatch(name)
if m == nil {
return "", false
}
// m[1] is YYYY-MM-DD; keep year and month
return filepath.Join(root, m[1][:4], m[1][:7]), true
}
Everything else is error handling and a --dry-run flag, which I've come to think of as mandatory for anything that moves files around. Seeing the planned moves before they happen has saved me from a few embarrassing mistakes.
Why Go for something this small
I reach for Go on these because the result is a single binary with no runtime to install. I build it once, drop it in my path, and it keeps working without me thinking about dependencies. Cross-compiling for the other machines I use is one command. For a throwaway tool that I nonetheless want to keep, that combination is hard to beat.
None of this is sophisticated. But scratch-your-own-itch tools rarely need to be — they just need to exist, and to be boring enough that you trust them with your files.
← Back home