Skip to content

Python script to sort photos in a new year-month folder structure based on their creation date

Notifications You must be signed in to change notification settings

lksrpp/py-photo-sorter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

Summary: py-photo-sorter

This repository features a small python script to sort photos and videos based on their creation date in a year-month folder structure.

Background & use case

I created this script to quickly create a new year-month strucutre for a large amount of photos and some video files located in one common folder. The new structure is ideal to store photos and videos on your Synology NAS, eg, at the Synology Photos application directory.

Usage

  1. Clone this repository to a local directory
  2. Install dependency package exifread to your (virtual) environment (eg, pip install exifread)
  3. Specify the absolute path to the source directory (line 49), that includes the photos & videos you would like to sort
    • The script only works with photos with ending "HEIC", "JPEG", "jpeg", "JPG", or "jpg", and videos with ending "MOV", "mov", or "mp4".
    • You can change the file types in case you want to consider additional files.
    • Subfolders are ignored.
  4. Specify the target directory (line 52), where the sorted photos should be copied to. As per default, a new directory "photo_sorted" is created within the source directory.
    • The script copies photos in a folder structure based on their creation date (eg, /photo_sorted/2020/08/).
    • For photos, the script tries to derive the creation date based on exif data. In case the exif data is not set, the fallback option is the modified date.
    • For videos, the script derives the creation date based on the modified date of the file.
  5. Run the script

About

Python script to sort photos in a new year-month folder structure based on their creation date

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages