Importing Multiple SD Cards into One Folder on Mac


I recently built a 5-camera bullet time rig, and set it up so that each of the cameras fire simultaneously. I shared a post on how I built it here. After doing a couple shoots with it, I realized that it can be really annoying to import multiple SD cards one after another.

There’s a lot of steps to using this camera rig, since it is five separate cameras with five separate SD cards to import. So every little thing I did what I could to reduce friction is time well spent.

I wanted to make it as smooth as possible to go from shooting, to uploading to sharing the finished photos on a website. So to make things automated, I built a script to import all five of them at once into unique folders.

One Script to Import Them All

This script should only take you just a few minutes to install, and you can customize it to your needs. Here’s what it does:

  1. Imports all the images into folders named “1”, “2”, “3”, “4”, “5” on the Desktop.
  2. If those folders don’t yet exist, it’ll create them (nice!)
  3. Asks what you want to rename the file prefix. So instead of all the files being called “IMG_0001.jpg” etc, I can type some text to replace the “IMG_” with something of my choosing.
  4. The script then ejects all of the SD cards safely.

The best part of this is that you don’t have to navigate the folders on multiple SD cards. Normally you’ll open “DCIM” then click through to 100_Canon” then select all, copy, and then again navigate to where you want the folders to go.

Notes before starting

  • This script and guide is for Mac OS.
  • If any of the below is confusing, here’s a quick primer on how run scripts and stuff on your mac.
  • This is set up for Canon SD cards’ filename and structure, but you can adjust the line in the script to make it work for any camera.

Set up Automatic Import for Multiple SD Cards

First you’ll want to rename your cards to each have a unique name.

Step 1: Rename all of your SD Cards

To do this, you connect your SD card to your Mac, and then right click on the icon in finder and select “Rename.” On my set up, I called them GIF1, GIF2, GIF3, GIF4, and GIF5. If you call your cards a different name, you can change it in the script.

Next make sure you’ve got Python 3 on your system. You can download Python 3 for Mac here.

Then make sure that tkinter is installed:

pip3 install tkinter

This allows you to type in a prefix to rename all the files. This should come with Python.

Finally you can open a script editor (I use Visual Studio Code), and paste in this script below. Save it as or whatever you want to name it.

import os
import shutil
import tkinter as tk
from tkinter import simpledialog
import subprocess
# Set the folder where you want the photos to go:
DEST_BASE = os.path.expanduser("~/Desktop/")
# Set your Camera's Names
SD_NAMES = ["GIF1", "GIF2", "GIF3", "GIF4", "GIF5"]
# Set the desired image extensions
IMAGE_EXTENSIONS = (".jpg", ".jpeg", ".cr2", ".arw", ".nef")
# Create a Tkinter root window (hidden)
root = tk.Tk()
# Prompt the user for custom text using a popup dialog (only once)
custom_text = simpledialog.askstring("Custom Text", "Enter custom text to replace 'IMG_' for all images:")
# Loop through the SD card names
for i, sd_name in enumerate(SD_NAMES, start=1):
    # Construct the source path based on the SD card name
    SRC_PATH = f"/Volumes/{sd_name}/DCIM/100CANON/"
    # Construct the destination path
    DEST_PATH = os.path.join(DEST_BASE, str(i))  # Folders named 1, 2, 3, 4 on Desktop
    # Check if the source path exists
    if os.path.exists(SRC_PATH):
        print(f"Transferring images from {sd_name} to folder {i}")
        # Transfer images using shutil.copytree
        shutil.copytree(SRC_PATH, DEST_PATH, dirs_exist_ok=True)
        # Rename the transferred files
        for filename in os.listdir(DEST_PATH):
            if filename.startswith("IMG_") and filename.lower().endswith(IMAGE_EXTENSIONS):
                old_path = os.path.join(DEST_PATH, filename)
                new_filename = filename.replace("IMG_", custom_text)
                new_path = os.path.join(DEST_PATH, new_filename)
                os.rename(old_path, new_path)
        print(f"Transfer and renaming complete for {sd_name}.")
        # Eject the SD card["diskutil", "eject", f"/Volumes/{sd_name}"])
        print(f"SD card {sd_name} ejected.")
        print(f"SD card {sd_name} not found.")

Then just run the script by double-clicking it. If Python Launcher isn’t set as the default application, you’ll instead right-click on the file, and do “Open With” and select Python Launcher.

Or you can navigate to the folder where you saved and type:


Final Notes:

This script should work out of the box for Canon DSLR cameras with the default structure. But if you use a different cameras or have customized your folder structure, you’ll want to make changes to a couple lines.

For instance, if you use a newer Sony A7III, you’ll want to adjust the code where it describes the folder and file name:

  • Rename /DCIM/100CANON/ to instead say /DCIM/100MSDCF/
  • Rename everywhere that says IMG_ to instead say DSC

Happy Importing

If this was useful, let me know in the comments. Or if you have any trouble, let me know where you’re getting stuck and we can work it out.

Leave a comment

Your email address will not be published. Required fields are marked *