You are not logged in.

#1 2018-05-06 18:05:09

KylieGS
Member
Registered: 2018-02-19
Posts: 53

Photo management

I'm an avid photographer and I was hoping to organise my now very convoluted photos collection. I'm looking for a program that will go through the files in a certain directory ( recursively ) and place them into a new folder structure organised based on the EXIF data on the file. While most photo organising programs will do this when importing from a camera, I was to do it to my entire photo collection ( ~ 4000 files ) that are currently organised chaotically as I change software and prefered organisation format etc. . Do you know of any software that will do this well? I've tried Darktable and digiKam to no avail.

Offline

#2 2018-05-06 18:49:04

Morn
Member
Registered: 2012-09-02
Posts: 886

Re: Photo management

A few years ago I wrote a Python 3 script to add the EXIF date to the file name of each photo recursively. The sorted files are copied to the ../sorted folder. You could probably change this script to create folders based on dates or other EXIF information. I would copy some sample photos to a test folder and experiment with the script. Note that it needs the exiv2 package installed.

You run it with:
cd foldername
python mv_exif.py

#!/usr/bin/env python

# rename and copy photos according to their EXIF date order

# needs exiv2

import os, subprocess, shutil

fn = list(os.walk('.'))[0][2]

for f in fn:
	if ('.jpg' in f or '.JPG' in f) and f[0] != '.':
		cmd = ['exiv2', '-K', 'Exif.Photo.DateTimeOriginal', f]
		r = subprocess.check_output(cmd)
		r = r.decode("utf-8", "ignore")
		r = r[60:].strip().replace(' ', '_')
		f2 = "../sorted/" + r + "__" + f
		f2 = f2.replace(':', '-')
		print (f,f2)
		shutil.copyfile(f, f2)

Last edited by Morn (2018-05-06 18:57:46)

Offline

#3 2018-05-06 18:53:20

KylieGS
Member
Registered: 2018-02-19
Posts: 53

Re: Photo management

Thank you! I was just looking up how to do this! I think I've tried every program in the repos with the word photo in it at this point!

Offline

#4 2018-05-06 19:00:38

Morn
Member
Registered: 2012-09-02
Posts: 886

Re: Photo management

Also, I think you have to create the "../sorted" folder yourself first; I am not sure if shutil.copyfile() does it automatically...

Offline

#5 2018-05-06 21:20:06

KylieGS
Member
Registered: 2018-02-19
Posts: 53

Re: Photo management

Yeah I'm just using your script as a guide, I'm having too much fun programming again to do anything but overdo it. Also, I like your icon!

Offline

Board footer

Powered by FluxBB