This Golang program will organise all of your dropbox photos folder and move them into folders based on year and month.

Introduction

You can automatically upload all of your phone’s photos to dropbox. However, for some reason, it just doesn’t organise them. Perhaps there is a hidden option, but I cannot find it.

You end up with all your photos in one directory – in my case, it was 1000’s over many years which make it hard to open the folder on your computer.

Camera uploads folder has hundreds of files

Sorting The Files

Fortunately you can see that dropbox timestamp the files. This means you can take the following file as an example.

2019-03-06 20.07.12.jpg

Sorting into years.

Taking the above file as an example it would be nice to have a top-level year folder first. This could then go in the 2020 folder.

Photos sorted into years

Sorting into months.

Next it would be nice to sort any given year into months. I prefer them numbered so they can be ordered.

Photos sorted into months

Coding in Go

Golang allows you to create a cross-platform executable which will run on both Mac and Windows.

It only took an hour to write something to sort the files in Go to process the files as above.

The full code is here.

https://github.com/johndobie-blog/sort-dropbox-photos

Running The Executable

Download the above code and then you can simply run the executable from the bin directory and point it at your camera uploads directory.

dropbox -uploadDir="D:/Dropbox/Camera Uploads"

Take a look at your dropbox folder and you should find all of your photos are neatly arranged.