Alright, so today I wanna chat about this little project I tackled – I’m calling it “for phillip.” It’s nothing crazy, just a fun exercise I cooked up over the last few days, and I figured I’d walk you through it.
It all started when I was trying to help my buddy Phillip (hence the name) organize his ridiculously messy photo collection. Seriously, thousands of pictures just dumped into a single folder. He was drowning in memories! So, I thought, “Why not build a simple tool to help him sort things out?”
First, I sat down and really thought about what the tool needed to do. Basically, I wanted it to:

- Read all the photos from his chaotic folder.
- Extract the date the photo was taken (if that info was available).
- Create new folders, one for each year.
- Move the photos into the correct year folder.
Pretty straightforward, right?
Okay, so next I jumped into coding. I decided to use Python – it’s my go-to for quick little projects like this. Plus, it has some great libraries for working with images.
I started by importing the necessary modules – `os` for file system stuff, `PIL` (Pillow) for image manipulation (specifically, getting the date from the EXIF data), and `datetime` for, well, handling dates.
Then came the fun part – actually reading the files. I used `*()` to grab a list of all the files in Phillip’s mega-folder. Then, I looped through each file, checking if it was actually an image file (like a .jpg or .png).

Inside the loop, I tried to open the image with Pillow and extract the EXIF data. EXIF data is basically metadata that’s stored inside the image file – things like camera settings, location, and, most importantly, the date the photo was taken.
Now, EXIF data isn’t always perfect. Sometimes it’s missing, sometimes it’s in a weird format. So, I had to add some error handling. If the EXIF data was missing or couldn’t be parsed, I just skipped the photo and moved on. But if I could get the date, I formatted it nicely into a year (like “2018”).
Next, I needed to create the year-based folders. I used `*()` to create the full path to the year folder, and then `*()` to actually create the folder if it didn’t already exist. The `exist_ok=True` argument is a lifesaver here – it prevents the script from crashing if the folder already exists.
Finally, the grand finale – moving the photo into the correct year folder. I used `*()` to move the file from its original location to the new year folder. Bam! One photo sorted.
I ran the script on a small sample of Phillip’s photos first, just to make sure everything was working correctly. And guess what? It worked! (Mostly. I had to tweak a few things to handle different date formats, but nothing major.)

Then, I let it rip on his entire collection. It took a while, but when it was done, his photos were neatly organized into year folders. He was thrilled!
Honestly, it was a pretty simple project, but it was really satisfying to help Phillip out and create something useful. Plus, I got to brush up on my Python skills. Not bad for a weekend project!
If you’re thinking of tackling a similar project, here are a few tips I picked up along the way:
- Error handling is key. Image files can be messy, so be prepared to handle missing or malformed data.
- Test on a small sample first. Don’t just unleash your script on a huge collection of files without testing it first!
- Use a good image library. Pillow is your friend.
That’s pretty much it! “for phillip” – a simple little project that made a big difference for my buddy. Maybe it’ll inspire you to build something cool too.