Python script to copy files in a structured way (year/month in destination) via EXIF

Hi there. This is my first post. I am grateful for the developers of Nextcloud. Made my life easier.

Here is a little contribution from me to people who (want to) upload their photos to Nextcloud in year/month structured folders. Phone client of Nextcloud normally does that. However if you have a collection of photos that is not same folder structure that you want to add later (after initial setup), you are not in luck. The Python script I am sharing here will help for that.

It will take all the files (not only photos) on a specific folder (source folder in the script), and copy them to the destination folder (you need to define in the script) in a year / month structure (just like the NextCloud client).
It will first use EXIF data, if EXIF data doesnt exist, it will use file creation date. It will not rename any file.

Once done, you can integrate the destination folder contents to your NextCloud account by moving files. Then you can do rescan and all should be fine.

Link to the script: Click here for Gihub link

1 Like