Divine Charles · Fullstack Product EngineerLoading
000%
Getting things ready…

(L/06) · experiment

File renamer

A Go program that renames batches of files into a clear “1 of 5” style name. It previews first by default.

01

What this is

This tool renames files in a folder called `sample` next to the program. It looks for names like `gallery_001.txt`, groups files that share the same base name and extension, then rewrites them to something like `Gallery - 1 of 5.txt`.

02

Dry run first

By default it runs in dry mode. It prints every `old => new` path and does not touch the disk. When you are happy with the plan, you run again with `-dry=false` to apply the renames. That default saved me from bad batches more than once.

03

How I built it

It is a single Go file. It walks the sample directory, parses names with a simple pattern (words, underscore, number, extension), sorts each group, then builds the new filenames. Extensions stay intact.

04

Why I made it

I kept rewriting the same rename script for photo and export folders. I wanted one small command with a preview step so I could see the result before anything moved.