I recently built a 5-camera bullet time rig. It’s set up so that each of the cameras fire simultaneously. 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. So every little time optimization counts.
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:
- Imports all the images into folders named “1”, “2”, “3”, “4”, “5” on the Desktop.
- If those folders don’t yet exist, it’ll create them (nice!)
- Asks what you want to rename the file prefix. This means that instead of “IMG_0001.jpg”, it’ll replace “IMG_” with something of my choosing.
- 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 this 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. You only have to do this once.
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 tkinterThis 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 sd-importer.py or whatever you want to name it — and then you’re done!
(Side note, I made another script recently that allows you to make a new file right in finder — perfect for situations like this).
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()
root.withdraw()
# 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
subprocess.run(["diskutil", "eject", f"/Volumes/{sd_name}"])
print(f"SD card {sd_name} ejected.")
else:
print(f"SD card {sd_name} not found.")Then you’re done!
Stick as many of your SD Cards in as you want and then double-click the sd-importer.py file you just created. It will pop-up with an input asking you to fill in your new prefix to replace “IMG_” and then it’ll get to work automatically importing these into the folder.
Note: if Python Launcher isn’t set as the default application, you may need to right-click on the file, and do “Open With” and select Python Launcher.
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.
Comments