The Media File Sorter is a Python script that organizes media files (e.g., photos and videos) based on their creation date. It can be especially useful for managing large collections of media files that lack proper organization. The script can process multiple files concurrently to improve efficiency.
Before using the script, ensure that you have the following dependencies installed:
- Python 3.10
- The
exiftool
library
You can install the required Python libraries using pip
:
pip install -r requirements.txt
Intent to is to run each script individually with human in the loop.
- Run 'sort_img.py' script to organize media from source by YYYY-MM-DD format
- Run 'remove_dsstore.py' script to remove the .DS_Store file from camera
- Run 'remove_dupes.py' script to remove the duplicate files within each sub folder given a directory.
- Run 'rsync' command to merge new media to master media directory, 'rsync -avh --progress --ignore-existing /source/folder/ /desitnation/folder'
To sort your media files, run the script as follows:
python sort_img.py source_dir dest_dir num_threads log_file
source_dir
: The source directory containing your unsorted media files.dest_dir
: The destination directory where the sorted files will be placed.num_threads
: The number of threads for concurrent processing (adjust this based on your system's capabilities).log_file
: The output log file to record the sorting process and statistics.
Sorting media files in /mnt/nas/unsorted_photos_to_import/
into /mnt/nas/TEST_SORT_OUTPUT/
using 47 threads:
python sort_img.py /mnt/nas/unsorted_photos_to_import/ /mnt/nas/TEST_SORT_OUTPUT/ 47 /mnt/nas/test_sort_output.txt
The .DS_Store
file remover is a Python script designed to remove all .DS_Store
files from a directory. These files are commonly created on macOS systems and can clutter your directories when transferred to non-macOS systems.
To remove .DS_Store
files, run the script as follows:
python remove_ds_store.py directory
directory
: The directory in which you want to remove.DS_Store
files.
Remove .DS_Store
files from a directory:
python remove_ds_store.py /mnt/nas/your_directory/
The Duplicate File Remover is a Python script designed to find and remove duplicate files within a directory. It uses the SHA-256 hash of files to identify duplicates and provides the option to perform a dry run, allowing you to see what would be removed without actually deleting files.
Before using the script, ensure that you have the following dependencies installed:
- Python 3.10
To remove duplicate files, run the script as follows:
python remove_dupes.py directory [--dry-run]
directory
: The directory in which you want to find and remove duplicate files.--dry-run
(optional): Print what would be removed without deleting files. Use this flag for a trial run.
Remove duplicate files from a directory:
python remove_dupes.py /mnt/nas/your_directory/
Remove duplicate files from a directory with a dry run:
python remove_dupes.py /mnt/nas/your_directory/ --dry-run
The folder synchronization script is a Bash script that uses the rsync
command to synchronize files from a source folder to a destination folder. It can be used to keep two directories in sync efficiently. Please make sure you have rsync
installed on your system.
-
Edit the script to set your source folder, destination folder, and the number of CPU cores to utilize for parallel synchronization.
-
Run the script:
./sync_folders.sh
Edit the script to specify your source and destination folders, and the number of CPU cores, and then run the script.