top of page

I Used Claude Code to Create a Photo Import Script

  • Writer: Ray Alner
    Ray Alner
  • Jul 28
  • 4 min read

My Problem

So I’m a photographer on the side. You can see my work here.

One of the issues that I have is organization when I get back from a shoot. I usually get back, unload the photos, charge my camera, clean my lens and make sure everything's ready for the next shoot.

The problem I had was there was no “great” way to offload all my photos when I get the SD card plugged in the way I want it.

Yes, Lightroom has an import feature, but I may as well throw my photos at the wall for how little that system-from-1990 helps. It looks like it hasn’t had an update for the last 20 years. I don’t use the “new” Lightroom, but I’ve heard thats even worse.

I looked around and found some marginally better tools, but they all were way over-bloated for what I needed.

My Solution

So after a few iterations, this is what I ended up getting to Claude Code.

For those unfamiliar, Claude Code is Anthropic's agentic command line tool that lets you delegate coding tasks directly to Claude AI from your terminal. Instead of copying and pasting code back and forth, you can have a conversation with Claude about what you want to build, and it writes, tests, and refines the code in real-time on your machine.

  1. Organize my photos based on their file type:

    1. Video → video

    2. Raw → raw

    3. JPG/Compressed → photo

  2. Filter out all system files (important when importing from a Sony camera, since Sony makes a bunch of different extra files) I don’t care about those files.

  3. Create separate folders for each day’s shoot. Usually my shoots are single day shoots. I format the name as MM-DD-YY [Shoot Name], I asked it to pull the date of the photos from the metadata, iterate through them, then ask me to name each new day’s shoot in the command window.

  4. Since I organize by YYYY/MM-DD-YY [Shoot Name] I needed it to confirm it didn’t need to create a new year for next years photos. It will confirm the year’s photos and create a new main folder if needed.

  5. I told it the safety features I needed:

    1. Verify the files were copied correctly, if not, show an error.

    2. Never overwrite or delete files from either location.

    3. Handle duplicate file names gracefully.

  6. Eject the SD card after a successful import (still working the bugs out of this one but supposed to)

After about an hour of vibe coding I was able to create this script.

ree
ree

How it Works

  1. Plug in SD card - The script automatically detects it (even handles multiple cards)

  2. Run the import command - Just double-click the executable file

  3. Name your shoots - The script finds photos by date and prompts me to name each day's session

  4. Sit back - It copies everything to the right folders, verifies file integrity, and handles duplicates

  5. Done - Clean, organized photos ready for editing

What used to take me 15-20 minutes of manual dragging, renaming, and organizing now takes about 2 minutes of actual work. The script does the heavy lifting while I grab coffee.

Issues I had to Iron Out

Here are some issues I had with it:

  • I forgot about the system files, so it took me a couple rounds to make sure it wouldn’t copy the system files from the SD card.

  • It struggled with the SD card slot for a bit, it couldn’t seem to find the correct card, until I told it that it was an “Untitled” card, then it seemed to have fixed those issues. It was also cool that it could handle multiple SD cards, it would list them out and if there was more than 1, it would ask which one you want to run it on.

  • I use Ghostty as my terminal, just like it better, but it wouldn’t run .sh scripts natively. This is obviously a user error issue, I’m sure there’s something I could do better here but I haven’t really looked into that issue. When I told CC that, it created a exec file called import I could click and run inside a terminal window instead of Ghostty.

ree
  • I massaged it a bit to make sure it could handle multiple day shoots based on metadata.

  • It struggled with the echo-print command, would ask for input then write over with a log, so couldn’t type the shoot name.

  • It kept running into some permission errors, which I’m still not sure if it handled gracefully, but so far no errors after it figured out how to handle those errors.

Two things I’ll want to fix in the future:

  • Click to exit the terminal window.

  • Fix the auto-ejecting feature. It doesn’t work for some reason.

Final Thoughts

Now, for a developer to write this, I’m sure they could pop this out in a quick 30 minutes and make it far more elegant, and less than it’s almost 500 lines of code.

But that’s not a problem for me.

For me, I was able to create this myself.

If it was going into production or some performance sensitive workflow? I would very much so have this look at by a developer, heck I wouldn’t even be offended if they re-wrote the whole thing from scratch.

But for most of us, Claude Code, can help someone with an idea, a basic idea to improve the workflow of something really basic and bothersome, but too high a cost for a developer to create unless the business case was made, to now an hour and a great set of requirements for a Cybersecurity/Systems Engineer to push out.

As I’ve said before: AI currently won’t help top developers be better.

AI will help those that are just looking for a quick win, or a simple tool, be less dependent on developers, and let those developers who are held back creating tools that aren’t advancing the world’s development chops, create something even more elegant, by letting those of us that can read code, now write a basic structure that will do the job we’ve been doing manually, and STILL make improvements to our workflow to things that are more important.

Oh, and it created the readme for me. That was really nice too.

Comments


Before You Leave...

I'm currently between jobs and dedicating my time to creating content here on the blog and my other creative outlets. If you've found value in what I'm sharing, consider buying me a coffee to help keep me fueled while I continue writing and job searching. Every contribution, no matter how small, means the world to me.

Thanks for reading and for any support you can offer!

bottom of page