Sd-copy moves DCIM files from an SD card and sorts them according to metadata into a given target folder. The following cameras are supported:
- Fujifilm X-T3
- DJI Osmo Action
Executing sd-copy via
sd-copy sort [source path] [output path]
a DCIM folder structure in [source path]
such as
[source_path]
├── DJI_0163.MOV
├── DSCF0226.JPG
├── DSCF0229.MOV
├── DSCF0230.MOV
├── DSCF0231.JPG
├── DSCF0231.RAF
└── DSCF0232.MOV
is copied to [target path]
with the following structure
[target path]
out/
├── 2021-07-08
│ ├── 20210708-173628_x-t3_DSCF0226_6240x4160.jpg
│ ├── 20210708-173906_x-t3_DSCF0229_1080p-24fps.mov
│ ├── 20210708-174010_x-t3_DSCF0230_2160p-59.94fps.mov
│ ├── 20210708-174028_x-t3_DSCF0231_4416x2944.raf
│ ├── 20210708-174028_x-t3_DSCF0231_6240x4160.jpg
│ └── 20210708-174626_x-t3_DSCF0232_1080p-24fps.mov
└── 2021-07-12
└── 20210712-075107_dji-oa_DJI0163_2160p-29.97fps.mov
If you're looking for a general purpose tool for moving photos and videos from an SD card, please consider Damon Lynch's much more advanced Rapid Photo Downloader. In my case, the bug described here and here initially prevented me from using the tool.
After starting this project I realized that the problems are more severe, both the Fujifilm X-T3 and DJI Osmo Action set incorrect timestamps in either file modification date (X-T3) or the Exif modify date (Osmo Action). In order to have at least one reliable timestamp, I extended this tool to set file modification dates for all copied files explicitly.
First install exiftool
(exiftool.org). Then, in the root directory of this project
pip install .
to install the tool in your current environment.
For development, install the project using Poetry as usual (poetry install
).
If you need DCIM data for local development or testing, use
git submodule init
to initialize your local configuration file, and
git submodule update
to download the files. Alternatively you can clone this repository with the --recurse-submodules
flag.
Run unit tests with
pytest tests/unit
and integration tests with
pytest tests/integration
Integration tests require the dcim
git submodule.
It is currently not possible to directly install a pyproject.toml
based package in editable mode (pip install -e
). If you need this, you can create a setup.py following the steps below.
First add setuptools
to the pyproject.toml
[build-system]
requires = ["setuptools", "poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
Then create a setup.py
via
poetry build --format sdist
tar -xvf dist/*-`poetry version -s`.tar.gz -O --wildcards '*/setup.py' > setup.py
With setup.py
present, you should be able to install in editable mode using pip install -e
.
This solution is from the discussion here. See also this discussion, PEP 606 and the discussion here.