Archive for September 2015

Flash card photo copy script

Something sorely missing in OSes and photo organization apps – a simple way to move your photos to hard drive and organize them by date. Here’s the script I’ve been using for couple of years, so it’s battle tested. This is looking for Canon camera folders on E: flash card, and using D: drive for storage – so adjust as necessary.
This is designed to keep your raw files separate from jpegs – I always shoot raw+jpeg or just jpeg, so this works well to de-duplicate my photo organization apps (lightroom and picasa).
The resulting folders are stored in d:\Raws and d:\Photos using the photo’s date as folder names.

@echo off
set "source=D:\Photos\TempTransfer\Incoming"
set "targetRoot=D:\Photos\TempTransfer\Outgoing"
set "targetRootRaw=D:\Photos\TempTransfer\OutgoingRaw"

robocopy E:\DCIM\100CANON\ "%source%" *.* /move
robocopy E:\DCIM\101CANON\ "%source%" *.* /move

for %%F in ("%source%\*") do (
  for /f "tokens=1,2,3 delims=/ " %%A in ("%%~tF") do (
    if "%%~xF" == ".CR2" (
        if not exist "%targetRootRaw%\%%C-%%A-%%B" mkdir "%targetRootRaw%\%%C-%%A-%%B"
        move "%%~fF" "%targetRootRaw%\%%C-%%A-%%B"
    ) else (
        if not exist "%targetRoot%\%%C-%%A-%%B" mkdir "%targetRoot%\%%C-%%A-%%B"
        move "%%~fF" "%targetRoot%\%%C-%%A-%%B"
    )
  )
)

robocopy /move /e "%targetRootRaw%" d:\Raws
robocopy /move /e "%targetRoot%" d:\Photos