Skip to main content

Safely move photos and videos

Project description

Safely move photos and videos from a source directory with arbitrary files to photo and video destination directories. The media type of the file is used to determine if it’s a photo or video. Any other media types are ignored.

The date and time the photo or video was taken is detected (if possible). If it is a photo, the EXIF DateTimeOriginal tag is used if present. Else for photos or videos, the date taken is inferred from the file name since most media files are named by date taken. Finally, the modify time of the file is used as a best guess. The destination files are organized by year and given a consistent file name based on the detected date taken. If a destination file with the same date taken and different checksum exists, an incrementing suffix is appended to the file name.

You can optionally remove photos and videos from the source directory that are older than a provided number of days. Files are only removed if the media file is copied and matching checksum is verified or if the media file with matching checksum already exists in the destination.

You can skip files that were recently modified within a provided number of minutes.

My Use Case

I run this on my Dropbox camera uploads every night to:
  1. Free up space on Dropbox

  2. Point Plex at split up photos and videos directories

  3. Backup the organized photos and videos

Here’s the crontab:

# move dropbox camera uploads out of dropbox into media folders
0 2 * * * mvmedia Dropbox/Camera\ Uploads --photos=Media/Pictures --videos=Media/Videos --remove=30 --recent=30 --verbose >> /var/log/dropbox/mvmedia.log

Usage

Help:

usage: mvmedia [-h] --photos PHOTOS --videos VIDEOS [--remove REMOVE]
                  [--recent RECENT] [--verbose]
                  source

Move and rename photos and videos

positional arguments:
  source           Source folder to read media from

optional arguments:
  -h, --help       show this help message and exit
  --photos PHOTOS  Destination folder to move photos to
  --videos VIDEOS  Destination folder to move videos to
  --remove REMOVE  Remove files older than provided days
  --recent RECENT  Skip files recently modified within the provided minutes
  --verbose        Print verbose output

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mvmedia-1.0.1.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mvmedia-1.0.1-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file mvmedia-1.0.1.tar.gz.

File metadata

  • Download URL: mvmedia-1.0.1.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.8

File hashes

Hashes for mvmedia-1.0.1.tar.gz
Algorithm Hash digest
SHA256 bbf8635311f05b4210bb4d6d6e3c279a655b953f28810d1479dc93dbfff0da22
MD5 9a1e3046fdd555ba382650401fc21324
BLAKE2b-256 22d5e55cc608521d82a0ccc8a97529013e9d722d3ed917af2eff21b1e4871bad

See more details on using hashes here.

File details

Details for the file mvmedia-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: mvmedia-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.8

File hashes

Hashes for mvmedia-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2a6bf556cbaf2748d0fb55c143aaa7f16ebe093b7a2e625405055cbb2b652511
MD5 2cb3007aacca5dc6a8228dbc8b9cce4d
BLAKE2b-256 3bd197501e587299361ed51e062d596c3e665c061c895be13d376b790ff1113d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page