How to do it...

Create the following script in filehandler.py to automatically organize your photos:

#!/usr/bin/python3 #filehandler.py import os import shutil import photohandler as PH from operator import itemgetter FOLDERSONLY=True DEBUG=True defaultpath="" NAME=0 DATE=1 class FileList: def __init__(self,folder): """Class constructor""" self.folder=folder self.listFileDates() def getPhotoNamedates(self): """returns the list of filenames and dates""" return self.photo_namedates def listFileDates(self): """Generate list of filenames and dates""" self.photo_namedates = list() if os.path.isdir(self.folder): for filename in os.listdir(self.folder): if filename.lower().endswith(".jpg"): aPhoto = PH.Photo(os.path.join(self.folder,filename)) if ...

Get Raspberry Pi 3 Cookbook for Python Programmers - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.