Skip to main content

sortmedia

Actions Status MIT License Badge Coverage Status GitHub issues

Dedupe and sort images and video files based on their creation date.

Image of Sorted Files

  • Handles images and video files.
  • Support for heic files (common iOS format).
  • Supports excluding directories.
  • Removes duplicates based on file hash.
  • Organizes files into year/month/day/files.ext.

Installation

pip install sortmedia

Command Line Usage

Sorting a directory of media files, move to destination directory.

Basic usage - processing a directory of media files foo and moving them to the destination directory bar.

sortmedia foo bar

Sorting a directory of media files, copy to destination directory.

Instead of moving files (the default), copy the files leaving the source directory foo intact.

sortmedia -c foo bar

or

sortmedia --copy foo bar

Exclude directory

You can list a set of directories that we should completely ignore. Assuming the following directory structure:

foo/
  ignoreMe/
  ignoreMeToo/
  img1.jpg
  img2.png
  ...

sortmedia --exclude=foo/ignoreMe,foo/ignoreMeToo foo/ bar/

Skip processing for a specified directory - but still move/copy.

If you have directories that are already sorted, that you'd like to skip processing but still move or copy you can mark them as "no process" directories. Assuming the following directory structure:

foo/
  alreadySorted/
  img1.jpg
  img2.png
  ...

sortmedia --noprocess=foo/alreadySorted/ foo/ bar/

This will result in alreadySorted/ being moved to bar/ without analyzing the files under that directory.

Programmatic Usage

The primary interface into sortmedia is the SortMedia class. This class can be instantiated and used as follows:

from sortmedia.sort import SortMedia
sort = SortMedia()
sort.process('src/', 'dst/')

This will process media in src/ and move the files to dst/.

Copying instead of moving

You can set the sorter to copy rather than move (which is the default):

from sortmedia.sort import SortMedia
sort = SortMedia(copy=True)

Specifying directories to ignore

Lets say you have a directory of photos, photos/, with two directories you want to completely ignore: ignoreMe and ignoreMeToo.

from sortmedia.sort import SortMedia
sort = SortMedia(excludes=['photos/ignoreMe', 'photos/ignoreMeToo'])

Move/copy but do not process directory

In some instances you might have a directory of media (e.g. photos/birthday-photos/) that you want to move or copy to the destination directory without processing the files in the directory. You can achieve this by passing a list of directories in the noprocess parameter.

from sortmedia.sort import SortMedia
sort = SortMedia(noprocess=['photos/birthday-photos/`])

Metadata

Release files for sortmedia 1.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sortmedia 1.2.1
File Size Uploaded
sortmedia-1.2.1.tar.gz 8.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sortmedia 1.2.1
File Interpreter ABI Platform
sortmedia-1.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 24.2 kB

Release files / sortmedia-1.2.1.tar.gz

Download URL sortmedia-1.2.1.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8dad7a04a044236ff71695660cd810bd34308b933fb951d9a8ce6b6cac00b796
BLAKE2b-256 checksum
How to use checksums
0a29bd723f0602c26c5a2b7df7e0bd4afb6d3be8bbc37d4110028b68385daf74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

Release files / sortmedia-1.2.1-py3-none-any.whl

Download URL sortmedia-1.2.1-py3-none-any.whl
Size 16.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c9f489c7345439cf50300dcd0561e6b107841f7f0118ed00092670be4cece6e
BLAKE2b-256 checksum
How to use checksums
f3ec66f287f40eb9e06ea900c0d243aea6b3e7d4bb092c568050826b1c0932b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

Release history Release notifications | RSS feed

This release

1.2.1 This release

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page