Media Sorter is a Python script designed for organizing and managing media files in a filesystem. It categorizes files based on their MIME types, detects and handles duplicates, and sorts files into structured directories.
- File Categorization: Sorts files into categories such as images, documents, music, videos, and others based on MIME type and file extensions.
- Duplicate Detection: Identifies duplicate files using file metadata and content.
- EXIF Data Extraction: For image files, extracts EXIF data to assist in sorting and duplicate detection.
- File Operations: Performs operations like copying, moving, and deleting files as part of the sorting process.
- Command-Line Interface: Offers a CLI for easy interaction and execution of various functionalities.
- Python 3
- PIL (Python Imaging Library) for EXIF data extraction
Clone the repository or download the script:
git clone https://github.com/hestonhamilton/media_sort.gitInstall the required dependencies:
pip install -r requirements.txtRun the script from the command line. It supports two main operations: dupecheck and copy.
Checks for duplicate files in the specified paths:
python media_sort.py dupecheck [paths] [options]Options:
--move-dupes: Move detected duplicates to a specified directory.--delete-dupes: Delete detected duplicates.
Sorts and copies files from the source directory to the destination directory:
python media_sort.py copy --source [source_directory] --dest [destination_directory] [options]Options:
--mode: Choose between 'date' (default) and 'category' sorting.--move-dupes: Move duplicates to a specified directory.--delete-dupes: Delete duplicates.
Specify a log file to record operations:
--log [log_file_path]The script includes a MediaSorter class, which can be configured by modifying the source code to suit specific sorting and duplicate handling needs.
Contributions to improve the script are welcome. Please follow the standard fork, branch, and pull request workflow.
This project is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License - see the LICENSE file for details.