A script to organize photos by creation date into year/month/day folders.
Project description
Photo Organizer
Photo Organizer is a Python script that sorts photos from a source directory into a target directory based on their creation date. The script can organize photos into year, month, and optionally day subfolders. It also supports copying or moving files, recursive directory traversal, and filtering by file extensions.
Features
- Organize photos into year/month/day folders based on creation date
- Move or copy files from the source to the target directory
- Recursively traverse directories
- Filter files by specified extensions
- Verbose logging for detailed information
- Flexible folder structure with optional top-level year-month folders.
Usage
Prerequisites
- Python 3.x
Installation
Install the package using pip:
pip install photo-organizer
Running the Script
photo-organizer [-h] [-r] [-d] [-e [ENDINGS [ENDINGS ...]]] [-v] [-c] [--no-year] source target
Arguments
- SOURCE_DIRECTORY: The source directory containing the photos
- TARGET_DIRECTORY: The target directory where the photos will be organized
Options
-r
,--recursive
: Sort photos recursively from the source directory-d
,--daily
: Organize photos into daily folders (year/month/day)-e
,--endings
: Specify file endings/extensions to copy (e.g., .jpg .png). If not specified, all files are included-v
,--verbose
: Enable verbose logging-c
,--copy
: Copy files instead of moving them--no-year
: Do not place month folders inside a year folder; place them top-level with the name format YEAR-MONTH
Examples
Move all files from source to target, organizing by year and month:
photo_organizer /path/to/source /path/to/target
Move all files recursively and organize by year/month/day:
photo_organizer /path/to/source /path/to/target -r -d
Copy only .jpg and .png files:
photo_organizer /path/to/source /path/to/target -e .jpg .png -c
Enable verbose logging:
photo_organizer /path/to/source /path/to/target -v
Move photos to top-level year-month folders without a year parent folder:
photo-organizer --no-year /path/to/source /path/to/target
Combine options to copy .jpg and .png files recursively into daily folders with verbose logging:
photo-organizer -r -d -e .jpg .png -v -c /path/to/source /path/to/target
Dwevelopment
To contribute to this project, follow these steps:
- Clone the repository.
- Install dependencies.
- Make your changes and add tests.
- Submit a pull request.
Logging
The script uses Python's logging module to provide detailed information about the operations performed. By default, the logging level is set to INFO. Use the -v
or --verbose
flag to enable DEBUG
level logging for more detailed output.
Contributing
Contributions are welcome! Please fork the repository and submit a pull request with your changes. Ensure that your code adheres to the existing coding standards and includes appropriate tests.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file photo_organizer-1.1.1.tar.gz
.
File metadata
- Download URL: photo_organizer-1.1.1.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3f3bd76d5387dee6f6a5cf5bb891296cfac41bce5c88fb68d616c4365348bf7 |
|
MD5 | 59da2eb5253fe4d27e231631e6a502a6 |
|
BLAKE2b-256 | d3697aff8a2e790f86e4c808f37855cb78f502c520c5724004c3513995d01fc7 |
File details
Details for the file photo_organizer-1.1.1-py3-none-any.whl
.
File metadata
- Download URL: photo_organizer-1.1.1-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30e226c0534c03bb8df9ed611433e32b117e1da457965eafdc85b3d7a81f479d |
|
MD5 | 4c86aa3c4a0f99809aa94d6dc9bd471b |
|
BLAKE2b-256 | e0af70248938a903aac76d1afae47781d50b9c3b16d43ec1b8b90f0eeae80c23 |