../sha1-rename

SHA-1 Rename

I started looking into Go out of curiosity and I really like it. It's simple and elegant. I don't have a CS background, so it has been a good learning opportunity. There are new concepts I need to learn, such as Goroutines and generics, but until then, I wanted to start with simple projects.

To start off, I thought of creating a program that renames files based on their SHA-1 checksum. With this implementation, it only renames images files, but it's easy enough to modify to include other file extensions.

As a comparison, I also wrote the same program in Python and R. Obviously, R is not something I would use for this sort of thing, but I just wanted to write the program in all 3 languages. I had the most fun in Go.

Project structure and unit tests were courtesy of ChatGPT.

Go

go run . /path/to/your/image/directory
> go-rename ~/Pictures/Wallpapers

Original      New
-----------   -----------
image_1.jpg   7a241a57d2475cad94811f78ed16bca6f4211c9d.jpg
image_2.png   0ce1279ff93f6aa62f1bb37c9bd8354038041e5c.png

Source: pymk/go-rename

Python

poetry run python pyrename/main.py /path/to/your/image/directory

Source: pymk/pyrename

R

Rscript main.R /path/to/your/image/directory
renamer::sha1("/path/to/your/image/directory")

Source: pymk/renamer