Simple python GUI app for sorting photos and videos into folders by year and months.
I wrote this application to solve my problem with unorganized folders with my photos. I had many folders with photos and videos all over my laptop. It wouldn't be much of an issue. But sometimes I just want to look at old photos, which was difficult with that kind of organization. Then I was going through photos that my parents took. They were all organized in folders by year and months. That gave me an idea to make python script to sort my photos the same way.
- Clone the repository:
git clone https://github.com/slanja/PhotoSort.git
- Install dependencies:
pip install -r requirements.txt
- Run the application:
python window.py
Select all photos you want to sort then select destination folder and click sort.
The main challenge was figuring out how to get the exact date when a photo was taken. I solved this by accessing the image metadata using the Pillow library.
- Metadata Priority: Since photos can have different tags, I created a priority list (
DateTimeOriginal,DateTimeDigitized,DateTime) to find the most accurate date. If no metadata is found, the app uses the file's modification date as a fallback. - Smart Folders: The app automatically creates a folder structure based on the date (e.g.,
2023/10). If a photo has no date information at all, it safely moves it to anUnknownfolder. - No Overwriting: I added a feature to handle duplicate filenames. If a file with the same name already exists in the destination, the app automatically renames the new one (e.g.,
image_1.jpg) so you never lose any data. - Libraries: I used
Pillowfor EXIF data and standard Python libraries likeosandshutilfor moving files and creating directories.
- add progress bar
- drag and drop
- test and debug
by Jan Slaný 🧂

