A golang photo organizer
April 23, 2020
A small program written in Golang to recursively organize your photo library by copying and sorting photos by year and month from a source to a dest folder. This is my first attempt at the go language. Feel free to improve it through pull requests!
Media files supported
.tiff .tif .gif .jpeg .jpg .png .raw .webm .mkv .avi .mov .wmv .mp4 .m4v .mpg .mp2 .mpeg
Build
go get github.com/rwcarlsen/goexif/exifgo build photosort.go
Run
./photosort [srcFolder] [destFolder]
Important: This has only been tested on Windows 10, let me know how it behaves in other OS.
Functionality
- Recursively visits all files and folders in the srcFolder directoy tree
- Analyses Exif data and copies to the necessary folder structure by year and month (creating folders if needed)
- Skips duplicated files and non-media files
Example folder structure, this:
origin│ image1.jpg│ image2.jpg│└───folder1│ │ image1.jpg│ │ video1.png│ ││ └───subfolder1│ │ image4.jpg│ │ image5.jpg│ │ image6.jpg│ │ file112.txt│└───folder2│ file021.txt│ image5.png
Becomes this:
organised└───2019│ └───1│ │ image1.jpg│ │ video1.png│└───2017│ └───1│ │ image4.jpg│ │ image2.jpg│ ││ └───3│ │ image6.jpg└───others│ image5.png